I'm trying to compile an android project to produce an .apk with maven (I'm not using Android Studio, I'm using IntelliJ idea)
1- I have downloaded this line command tool which I guess is the SDK Manager and I have extracted in a folder named Android, the extraction result produces a folder called tools.
2- I execute /Android/tools/android.sh
, it displays the SDK Manager and starts to download:
After the download is done, it creates new folders (I just create the "tools" folder and "android-keystore") on /Android:
3- I edit in ~/.bashrc
the ANDROID PATH as follows:
export ANDROID_HOME='/home/myUser/Android'
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/platform-tools
Question 1 : Is ANDROID_HOME pointing to the SDK Path?
When I try to make mvn clean install
of my android project I get this error:
[INFO] /usr/lib/jvm/java-7-oracle/jre/bin/java [-Xmx1024M, -jar, /home/nb022/Android/build-tools/22.0.1/lib/dx.jar, --dex, --output=/home/nb022/workspace/cl.claro/android/antica-sessmobile-android2/target/classes.dex, /home/nb022/.m2/repository/com/google/code/gson/gson/2.2.4/gson-2.2.4.jar, /home/nb022/.m2/repository/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar, /home/nb022/.m2/repository/antica/external/cordova/3.7.2/cordova-3.7.2.jar, /home/nb022/workspace/cl.claro/android/antica-sessmobile-android2/target/classes, /home/nb022/.m2/repository/commons-pool/commons-pool/1.3/commons-pool-1.3.jar, /home/nb022/.m2/repository/antica/base/antica-base-commons/4.16/antica-base-commons-4.16-jdk6.jar, /home/nb022/.m2/repository/commons-lang/commons-lang/2.4/commons-lang-2.4.jar, /home/nb022/.m2/repository/ch/acra/acra/4.5.0/acra-4.5.0.jar, /home/nb022/.m2/repository/de/mindpipe/android/android-logging-log4j/1.0.3/android-logging-log4j-1.0.3.jar, /home/nb022/.m2/repository/com/google/android/android/4.1.1.4/android-4.1.1.4.jar, /home/nb022/.m2/repository/log4j/log4j/1.2.17/log4j-1.2.17.jar, /home/nb022/.m2/repository/commons-collections/commons-collections/3.2.1/commons-collections-3.2.1.jar, /home/nb022/.m2/repository/org/apache/velocity/velocity/1.7/velocity-1.7.jar, /home/nb022/.m2/repository/org/json/json/20080701/json-20080701.jar, /home/nb022/.m2/repository/antica/core/antica-core-mobile/4.75/antica-core-mobile-4.75.jar, /home/nb022/.m2/repository/xpp3/xpp3/1.1.4c/xpp3-1.1.4c.jar, /home/nb022/.m2/repository/org/khronos/opengl-api/gl1.1-android-2.1_r1/opengl-api-gl1.1-android-2.1_r1.jar, /home/nb022/.m2/repository/xerces/xmlParserAPIs/2.6.2/xmlParserAPIs-2.6.2.jar]
[INFO] warning: Ignoring InnerClasses attribute for an anonymous inner class
[INFO] (org.apache.commons.logging.impl.LogFactoryImpl$1) that doesn't come with an
[INFO] associated EnclosingMethod attribute. This class was probably produced by a
[INFO] compiler that did not target the modern .class file format. The recommended
[INFO] solution is to recompile the class from source, using an up-to-date compiler
[INFO] and without specifying any "-target" type options. The consequence of ignoring
[INFO] this warning is that reflective operations on this class will incorrectly
[INFO] indicate that it is *not* an inner class.
[INFO] warning: Ignoring InnerClasses attribute for an anonymous inner class
[INFO] (org.apache.commons.logging.impl.LogFactoryImpl$2) that doesn't come with an
[INFO] associated EnclosingMethod attribute. This class was probably produced by a
[INFO] compiler that did not target the modern .class file format. The recommended
[INFO] solution is to recompile the class from source, using an up-to-date compiler
[INFO] and without specifying any "-target" type options. The consequence of ignoring
[INFO] this warning is that reflective operations on this class will incorrectly
[INFO] indicate that it is *not* an inner class.
[INFO] warning: Ignoring InnerClasses attribute for an anonymous inner class
[INFO] (org.apache.commons.logging.impl.LogFactoryImpl$3) that doesn't come with an
[INFO] associated EnclosingMethod attribute. This class was probably produced by a
[INFO] compiler that did not target the modern .class file format. The recommended
[INFO] solution is to recompile the class from source, using an up-to-date compiler
[INFO] and without specifying any "-target" type options. The consequence of ignoring
[INFO] this warning is that reflective operations on this class will incorrectly
[INFO] indicate that it is *not* an inner class.
[INFO] warning: Ignoring InnerClasses attribute for an anonymous inner class
[INFO] (org.apache.commons.logging.impl.SimpleLog$1) that doesn't come with an
[INFO] associated EnclosingMethod attribute. This class was probably produced by a
[INFO] compiler that did not target the modern .class file format. The recommended
[INFO] solution is to recompile the class from source, using an up-to-date compiler
[INFO] and without specifying any "-target" type options. The consequence of ignoring
[INFO] this warning is that reflective operations on this class will incorrectly
[INFO] indicate that it is *not* an inner class.
[INFO] warning: Ignoring InnerClasses attribute for an anonymous inner class
[INFO] (org.apache.commons.logging.impl.WeakHashtable$1) that doesn't come with an
[INFO] associated EnclosingMethod attribute. This class was probably produced by a
[INFO] compiler that did not target the modern .class file format. The recommended
[INFO] solution is to recompile the class from source, using an up-to-date compiler
[INFO] and without specifying any "-target" type options. The consequence of ignoring
[INFO] this warning is that reflective operations on this class will incorrectly
....
NFO] and without specifying any "-target" type options. The consequence of ignoring
[INFO] this warning is that reflective operations on this class will incorrectly
[INFO] indicate that it is *not* an inner class.
[INFO]
[INFO] trouble processing "javax/xml/namespace/QName.class":
[INFO]
[INFO] Ill-advised or mistaken usage of a core class (java.* or javax.*)
[INFO] when not building a core library.
[INFO]
[INFO] This is often due to inadvertently including a core library file
[INFO] in your application's project, when using an IDE (such as
[INFO] Eclipse). If you are sure you're not intentionally defining a
[INFO] core class, then this is the most likely explanation of what's
[INFO] going on.
[INFO]
[INFO] However, you might actually be trying to define a class in a core
[INFO] namespace, the source of which you may have taken, for example,
[INFO] from a non-Android virtual machine project. This will most
[INFO] assuredly not work. At a minimum, it jeopardizes the
[INFO] compatibility of your app with future versions of the platform.
[INFO] It is also often of questionable legality.
[INFO]
[INFO] If you really intend to build a core library -- which is only
[INFO] appropriate as part of creating a full virtual machine
[INFO] distribution, as opposed to compiling an application -- then use
[INFO] the "--core-library" option to suppress this error message.
[INFO]
[INFO] If you go ahead and use "--core-library" but are in fact
[INFO] building an application, then be forewarned that your application
[INFO] will still fail to build or run, at some point. Please be
[INFO] prepared for angry customers who find, for example, that your
[INFO] application ceases to function once they upgrade their operating
[INFO] system. You will be to blame for this problem.
[INFO]
[INFO] If you are legitimately using some code that happens to be in a
[INFO] core package, then the easiest safe alternative you have is to
[INFO] repackage that code. That is, move the classes in question into
[INFO] your own package namespace. This means that they will never be in
[INFO] conflict with core system classes. JarJar is a tool that may help
[INFO] you in this endeavor. If you find that you cannot do this, then
[INFO] that is an indication that the path you are on will ultimately
[INFO] lead to pain, suffering, grief, and lamentation.
[INFO]
[INFO] 1 error; aborting
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 19.901s
[INFO] Finished at: Fri Feb 24 14:46:58 CLT 2017
[INFO] Final Memory: 22M/218M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.6.1:dex (default-dex) on project antica-sessmobile-android2: MojoExecutionException: ANDROID-040-001: Could not execute: Command = /bin/sh -c cd /home/nb022/workspace/cl.claro/android/antica-sessmobile-android2 && /usr/lib/jvm/java-7-oracle/jre/bin/java -Xmx1024M -jar /home/nb022/Android/build-tools/22.0.1/lib/dx.jar --dex --output=/home/nb022/workspace/cl.claro/android/antica-sessmobile-android2/target/classes.dex /home/nb022/.m2/repository/com/google/code/gson/gson/2.2.4/gson-2.2.4.jar /home/nb022/.m2/repository/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar /home/nb022/.m2/repository/antica/external/cordova/3.7.2/cordova-3.7.2.jar /home/nb022/workspace/cl.claro/android/antica-sessmobile-android2/target/classes /home/nb022/.m2/repository/commons-pool/commons-pool/1.3/commons-pool-1.3.jar /home/nb022/.m2/repository/antica/base/antica-base-commons/4.16/antica-base-commons-4.16-jdk6.jar /home/nb022/.m2/repository/commons-lang/commons-lang/2.4/commons-lang-2.4.jar /home/nb022/.m2/repository/ch/acra/acra/4.5.0/acra-4.5.0.jar /home/nb022/.m2/repository/de/mindpipe/android/android-logging-log4j/1.0.3/android-logging-log4j-1.0.3.jar /home/nb022/.m2/repository/com/google/android/android/4.1.1.4/android-4.1.1.4.jar /home/nb022/.m2/repository/log4j/log4j/1.2.17/log4j-1.2.17.jar /home/nb022/.m2/repository/commons-collections/commons-collections/3.2.1/commons-collections-3.2.1.jar /home/nb022/.m2/repository/org/apache/velocity/velocity/1.7/velocity-1.7.jar /home/nb022/.m2/repository/org/json/json/20080701/json-20080701.jar /home/nb022/.m2/repository/antica/core/antica-core-mobile/4.75/antica-core-mobile-4.75.jar /home/nb022/.m2/repository/xpp3/xpp3/1.1.4c/xpp3-1.1.4c.jar /home/nb022/.m2/repository/org/khronos/opengl-api/gl1.1-android-2.1_r1/opengl-api-gl1.1-android-2.1_r1.jar /home/nb022/.m2/repository/xerces/xmlParserAPIs/2.6.2/xmlParserAPIs-2.6.2.jar, Result = 1 -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
The Project's POM contains this plugin:
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<executions>
<execution>
<id>manifest-version</id>
<goals>
<goal>manifest-update</goal>
</goals>
<configuration>
<manifest>
<versionCodeAutoIncrement>false</versionCodeAutoIncrement>
<versionName>${project.version}</versionName>
</manifest>
</configuration>
</execution>
</executions>
<configuration>
<assetsDirectory>assets</assetsDirectory>
<resourceDirectory>res</resourceDirectory>
<sdk>
<platform>16</platform>
</sdk>
</configuration>
<extensions>true</extensions>
<version>3.6.1</version>
</plugin>
This is the manifest of the project (android:minSdkVersion="8" android:targetSdkVersion="16"):
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:hardwareAccelerated="true" android:installLocation="internalOnly" android:versionCode="305" android:versionName="2.2.4" android:windowSoftInputMode="adjustPan" package="cl.myApp">
<supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.GET_TASKS"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="16"/>
<application android:allowBackup="true" android:hardwareAccelerated="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:name="com.myApp.SessMobileApplication">
<activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:excludeFromRecents="true" android:label="@string/app_name" android:name="com.myApp.ClaroSessMobile" android:process=":core" android:theme="@android:style/Theme.Black.NoTitleBar">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity android:label="@string/app_name" android:launchMode="singleInstance" android:name="cl.MyOrg.core.MyApp.activity.SessMobileDialog" android:process=":core" android:theme="@android:style/Theme.Dialog"/>
<activity android:name="com.myApp.SplashIntent"/>
<activity android:name="com.myApp.ErrorIntent"/>
<activity android:name="com.myApp.ErrorNetworkIntent"/>
<receiver android:enabled="true" android:exported="true" android:name="cl.MyOrg.core.MyApp.receiver.SessMobileActionReceiver" android:process=":core">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"/>
<action android:name="android.intent.action.EXTERNAL_APPLICATIONS_AVAILABLE"/>
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.PACKAGE_REPLACED"/>
<data android:scheme="package"/>
</intent-filter>
</receiver>
<service android:name="cl.MyOrg.core.MyApp.services.SessMobileCore" android:process=":core"/>
<service android:name="cl.MyOrg.core.MyApp.services.SessMobileNotifier" android:process=":core">
</service>
</application>
</manifest>
Hope you guys can help me with this error. Currently I'm using:
Apache Maven 3.0.5
Maven home: /usr/local/apache-maven-3.0.5
Java version: 1.7.0_80, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-7-oracle/jre
Default locale: es_CL, platform encoding: UTF-8
OS name: "linux", version: "4.4.0-21-generic", arch: "amd64", family: "unix"
IntelliJ IDEA.
I solve the problem, dowgrading the version of buildTools (Android/build-tools) from 25 to 23.0.3 and settign the dependency scope to provided
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android</artifactId>
<version>4.1.1.4</version>
<scope>provided</scope>
</dependency>