Skip to content

Test with xwalk AAR library

fujunwei edited this page Aug 22, 2014 · 21 revisions

Pre-requisites

  1. Install JDK that version need 6 or higher for Gradle. Then set JAVA_HOME environment to point to the install directory of the desired JDK.

    JAVA_HOME = /path/to/jdk
  2. Use Gradle Wrapper to build our project, Gradle will be automatically downloaded and used.Copy following construct files in your project directory from my sample(powerbuilder.sh.intel.com/public/junwei/AARTest/XWalkEmbed.tar.gz).

    RootProject/
      gradlew
      gradlew.bat
      gradle/wrapper/
        gradle-wrapper.jar
        gradle-wrapper.properties
    
  3. Install Maven (>version 3.1.1): maven.apache.org/download.cgi

  4. Setting Wrapper to work behind Proxy

    • build it with proxy first time for download Gradle.

      ./gradlew –Dhttp.proxyHost=127.0.0.1  -Dhttp.proxyPort=8118 clean build
    • For Connection to repo1.maven.org, make directory in /home/user/.gradle/ as gradle.properties, then add follow codes.

      systemProp.http.proxyHost=127.0.0.1
      systemProp.http.proxyPort=8118
      systemProp.https.proxyHost=127.0.0.1
      systemProp.https.proxyPort=8118
    • set maven proxy,in config/settings.xml config file

      <settings>
        <proxies>
          <proxy>
            <protocol>http</protocol>
            <host>127.0.0.1</host>
            <port>8118</port>
          </proxy>
        </proxies>
      </settings>

Use Crosswalk as Android library project

  1. Use AAR by local maven repository, Install it to projectRoot/libs directory. the Dversion is crosswalk version

    mvn install:install-file -DgroupId=com.xwalk -DartifactId=xwalk_core_library -Dversion=7.35.135.0 -DgeneratePom=true  -Dpackaging=aar  -Dfile=xwalk_core_library.aar -DlocalRepositoryPath=/path/to/projectRoot/libs

Create and Build your Android project with Crosswalk

  1. Create Android Project, using the Crosswalk webview APIs.

  2. The reference to maven repo in build.gradle will look like. if use local repo, the url is set to ‘libs’

    Repositories {
      Maven {
        url ‘https://download.01.org/crosswalk/releases/crosswalk/android/maven2’
      }
    }
  3. The dependency (a reference) to the AAR library will look like(7.35.135.0 is crosswalk version):

    Dependencies {
       Compile ‘com.xwalk:xwalk_core_library:7.35.135.0’
    }
  4. uncomment the line of “ext.multiarch=true” in libraries.gradle, which support multi architecture.

  5. Build your project with Gradle, follow command will build the corresponding arch apk in build/apk directory

    ./gradlew assemblex86 
    ./gradlew assemblearmv7

also we can use “./gradlew build” to build all of version at once.

  1. if report error about “failed to find build tools version 19.0.0”, please check it use “android” command.

Clone this wiki locally