i was trying to follow this tutorial:
http://www.gdgankara.org/2012/11/01/step-by-step-android-development-with-maven/
but after setting up the environment, and create a project, at the "run as\maven install" step i got this:
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building tutorial 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- android-maven-plugin:3.1.1:generate-sources (default-generate-sources) # tutorial ---
[INFO] ANDROID-904-002: Found aidl files: Count = 0
[INFO] ANDROID-904-002: Found aidl files: Count = 0
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.889s
[INFO] Finished at: Sat May 18 00:32:12 CEST 2013
[INFO] Final Memory: 8M/111M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.1.1:generate-sources (default-generate-sources) on project tutorial: Execution default-generate-sources of goal com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.1.1:generate-sources failed: Could not find tool 'aapt'. Please provide a proper Android SDK directory path as configuration parameter <sdk><path>...</path></sdk> in the plugin <configuration/>. As an alternative, you may add the parameter to commandline: -Dandroid.sdk.path=... or set environment variable ANDROID_HOME. -> [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.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException
I've tried lot of times, but with no luck.
I have Eclipse Juno on Windows7 64 bit, APK Tool installed and Maven 3.0.5.
It seems a well known problem for maven staff:
https://code.google.com/p/maven-android-plugin/issues/detail?id=104
but it should be solved from ages...
My Environment User variables:
M2_HOME=C:\Program Files\Java\apache-maven-3.0.5
ANDROID_HOME=C:\adt-bundle-windows-x86_64-20130514\sdk
My Environment System variable:
Path=......;%ANDROID_HOME%\tools;%ANDROID_HOME%\platform-tools;%ANDROID_HOME%\build-tools;%ANDROID_HOME%\platforms;%M2_HOME%\bin;%ANDROID_HOME%\build-tools\android-4.2.2
Does anybody know how to workout this trap?
thanks!
I also encountered the same problem when using latest ADT from google and trying to compile the bootstrap android platform.
The latest r17 build separate out aapt to build-tools folder. Hence it is maven-android-plugin cannot support it.
See issue discussed here.
Tried and working:
cd $ANDROID_HOME/platform-tools
ln -s ../build-tools/android-4.2.2/aapt aapt
ln -s ../build-tools/android-4.2.2/lib lib
ln -s ../build-tools/android-4.2.2/aidl aidl
Some installations may be structured using the API version:
cd $ANDROID_HOME/platform-tools
ln -s ../build-tools/17.0.0/aapt aapt
ln -s ../build-tools/17.0.0/lib lib
ln -s ../build-tools/17.0.0/aidl aidl
Keep in mind that this is fixed in the latest version (>3.5.3) of the Android Maven Plugin, as other answers point out.
Update:
This has been resolved since Android Maven Plugin v3.6.0. For now you will only need these symlinks if you use IntelliJ v12.x. IntelliJ v13 EAP+ should work out of the box.
Original answer:
This has been fixed and will be released with Android Maven Plugin v3.5.4. See the github pull request:
Upgraded AndroidSdk to use path and platform utilities from sdklib
You can try validating the snapshot build which contains the fix by adding the following to your pom.xml:
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<version>3.5.4-SNAPSHOT</version>
...
</plugin>
...
<pluginRepositories>
<pluginRepository>
<id>oss.sonatype.org-jayway-snapshots</id>
<name>Jayway OpenSource SNAPSHOTs on Sonatype.org</name>
<url>http://oss.sonatype.org/content/repositories/jayway-snapshots/</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
Please provide feedback on the developer group:
New snapshot for 3.5.4 available
If you are using Windows, the symbolic linking can be done using mklink command.
D:\>cd "Program Files (x86)\Android\android-sdk"
D:\Program Files (x86)\Android\android-sdk>cd platform-tools
D:\Program Files (x86)\Android\android-sdk\platform-tools>mklink aapt.exe ..\build-tools\17.0.0\aapt.exe
symbolic link created for aapt.exe <<===>> ..\build-tools\17.0.0\aapt.exe
D:\Program Files (x86)\Android\android-sdk\platform-tools>mklink aidl.exe ..\build-tools\17.0.0\aidl.exe
symbolic link created for aidl.exe <<===>> ..\build-tools\17.0.0\aidl.exe
D:\Program Files (x86)\Android\android-sdk\platform-tools>mklink /d lib ..\build-tools\17.0.0\lib
symbolic link created for lib <<===>> ..\build-tools\17.0.0\lib
I get stuck with the same problem. Finally i managed to resolve the issue after two hours. To make it simple and resolve the issue in 5 minutes i listed the steps below
Step 1 - In Eclipse update your Android Maven Plugin to 0.4.3.2013 using the beta release link
http://rgladwell.github.io/m2e-android/updates/master/
Step 2
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<version>3.6.1</version>
<configuration>
<sdk>
<platform>17</platform>
</sdk>
</configuration>
</plugin>
It will solve the following issues
"No Android Platform Version/API Level has been configured"
Could not find tool 'aapt'
Hope it helps
I too had similar problems.
Solved by following steps :
1) Upgrade maven to 3.1.1
2) Use android-maven-plugin 3.6.1 pr greater [I used 3.8.0]
3) Use maven-dependency-plugin 2.8
If you want to build against latest Android SDK [ex : 4.3], follow following additional steps -
4) Install the local copy of android.jar using command mvn install:installFile ..
5) Set 18
Hope this helps.
I'm using macOS 10.14 and in my case:
I download Android packaging tool from AAPT and then copied all the files into $ANDROID_HOME/platforms/$SDK/tools/
DON'T REMIND CHANGE $SDK WITH YOUR REAL NAME SDK FOR INSTANCE android-29
Related
I am going to show IP camera real-time on the mobile app.
So I downloaded Oney's RCTWebRTCDemo from GitHub to run it.
I did the following works.
Bians-iMac:MyHome byz$ git clone https://github.com/oney/RCTWebRTCDemo.git
Cloning into 'RCTWebRTCDemo'...
remote: Counting objects: 359, done.
remote: Total 359 (delta 0), reused 0 (delta 0), pack-reused 359
Receiving objects: 100% (359/359), 456.78 KiB | 303.00 KiB/s, done.
Resolving deltas: 100% (155/155), done.
Bians-iMac:MyHome byz$ cd RCTWebRTCDemo
Bians-iMac:RCTWebRTCDemo byz$ npm install
npm WARN deprecated connect#2.30.2: connect 2.x series is deprecated
npm WARN deprecated gulp-util#3.0.8: gulp-util is deprecated - replace it, following the guidelines at https://medium.com/gulpjs/gulp-util-ca3b1f9f9ac5
npm notice created a lockfile as package-lock.json. You should commit this file.
added 592 packages from 409 contributors and audited 5796 packages in 434.447s
found 24 vulnerabilities (13 low, 3 moderate, 8 high)
run `npm audit fix` to fix them, or `npm audit` for details
Bians-iMac:RCTWebRTCDemo byz$ npm audit fix
> fsevents#1.2.4 install /Volumes/STUDY/Work/MyHome/RCTWebRTCDemo/node_modules/fsevents
> node install
[fsevents] Success: "/Volumes/STUDY/Work/MyHome/RCTWebRTCDemo/node_modules/fsevents/lib/binding/Release/node-v57-darwin-x64/fse.node" already installed
Pass --update-binary to reinstall or --build-from-source to recompile
npm WARN react-native#0.56.0 requires a peer of react#16.4.1 but none is installed. You must install peer dependencies yourself.
+ react-native#0.56.0
added 407 packages from 157 contributors, removed 196 packages, updated 72 packages and moved 3 packages in 59.949s
fixed 20 of 24 vulnerabilities in 5796 scanned packages
1 package update for 4 vulns involved breaking changes
(use `npm audit fix --force` to install breaking changes; or refer to `npm audit` for steps to fix these manually)
Bians-iMac:RCTWebRTCDemo byz$ react-native link
Scanning folders for symlinks in /Volumes/STUDY/Work/MyHome/RCTWebRTCDemo/node_modules (9ms)
rnpm-install info Platform 'ios' module react-native-webrtc is already linked
rnpm-install info Linking react-native-webrtc android dependency
rnpm-install info Platform 'android' module react-native-webrtc has been successfully linked
Bians-iMac:RCTWebRTCDemo byz$ react-native run-android
Scanning folders for symlinks in /Volumes/STUDY/Work/MyHome/RCTWebRTCDemo/node_modules (11ms)
JS server already running.
Building and installing the app on the device (cd android && ./gradlew installDebug)...
File /Users/byz/.android/repositories.cfg could not be loaded.
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':WebRTCModule'.
> Could not resolve all dependencies for configuration ':WebRTCModule:_debugPublishCopy'.
> Could not find com.android.support:appcompat-v7:26.1.0.
Searched in the following locations:
file:/Users/byz/Library/Android/sdk/extras/android/m2repository/com/android/support/appcompat-v7/26.1.0/appcompat-v7-26.1.0.pom
file:/Users/byz/Library/Android/sdk/extras/android/m2repository/com/android/support/appcompat-v7/26.1.0/appcompat-v7-26.1.0.jar
file:/Volumes/STUDY/Work/MyHome/RCTWebRTCDemo/android/sdk-manager/com/android/support/appcompat-v7/26.1.0/appcompat-v7-26.1.0.jar
Required by:
RCTWebRTCDemo:WebRTCModule:unspecified > com.facebook.react:react-native:0.56.0
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 13.627 secs
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/getting-started.html
Operating System: mac OS HighSierra 10.13.5
Android SDK: 23.0.2 & 26 installed.
Can anyone tell me how to fix this?
Thanks for your attention.
You might miss appcompat-v7:26.1.0 in your android sdk.
Try to change to 27.+. It might help!
I downloaded zxing and tried to build it locally with mvn.
I got some problem, when I try to build android project (to make it a jar other than apk file), I got this error:
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------ ------
[INFO] Building Android Barcode Scanner app 4.7.1
[INFO] ------------------------------------------------------------------ ------
[WARNING] The POM for com.google.zxing:core:jar:3.1.1-SNAPSHOT is missing, no dependency information available
[WARNING] The POM for com.google.zxing:android-core:jar:3.1.1-SNAPSHOT is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.352 s
[INFO] Finished at: 2015-01-27T13:32:25+00:00
[INFO] Final Memory: 10M/36M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project android: Could not resolve dependencies for project com.google.zxing:android:jar:4.7.1: The following artifacts could not be resolved: com.google.zxing:core:jar:3.1.1-SNAPSHOT, com.google.zxing:android-core:jar:3.1.1-SNAPSHOT: Failure to find com.google.zxing:core:jar:3.1.1-SNAPSHOT in https://repo1.maven.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [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.
[ERROR]
I put android-core-3.1.1-SNAPSHOT.JAR AND core-3.1.1-SNAPSHOT.JAR into the libs folder of android project, but it doesn't help at all.
what I am doing wrong? The pom file under android folder is
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>android-core</artifactId>
<version>3.1.1-SNAPSHOT</version>
<packaging>jar</packaging>(i changed from apk to jar as I want to build it as a jar other than apk)
<dependencies>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android</artifactId>
</dependency>
</dependencies>
<parent>
<groupId>com.google.zxing</groupId>
<artifactId>zxing-parent</artifactId>
<version>3.1.1-SNAPSHOT</version>
</parent>
<name>ZXing Android Core</name>
<description>Code common to Android applications</description>
</project>
This is just a Maven question. You have downloaded source code for master, so points to SNAPSHOT builds. If you really want to use that, you need to mvn install to create snapshot artifacts locally. Here you just went straight to android/ and built it, but that won't work. Just build everything from the top level and it will work.
This is described at https://github.com/zxing/zxing/wiki/Getting-Started-Developing except that if you are building snapshots off master you need to mvn install not mvn package.
I'm trying to build Android projects on the OSX (Mavericks 10.9.5) command line using this how-to: http://developer.android.com/tools/building/building-cmdline.html.
This How-To explains the use of assembleDebug/assembleRelease to build an Android project.
Unfortunately gradle doesn't create the assembleDebug or assembleRelease targets.
Executing ./gradlew assembleDebug returns this:
FAILURE: Build failed with an exception.
* What went wrong:
Task 'assembleDebug' not found in root project 'test'.
* Try:
Run gradlew tasks to get a list of available tasks. Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 2.826 secs
Steps:
android create project
The test project has been created with android create project --path . --name "DummyAPK" --target android-21 --package com.dummyapk.dummyapk --activity DummyActivity
which returned
Created directory /Users/user/Documents/test/src/com/dummyapk/dummyapk
Added file ./src/com/dummyapk/dummyapk/DummyActivity.java
Created directory /Users/user/Documents/test/res
Created directory /Users/user/Documents/test/bin
Created directory /Users/user/Documents/test/libs
Created directory /Users/user/Documents/test/res/values
Added file ./res/values/strings.xml
Created directory /Users/user/Documents/test/res/layout
Added file ./res/layout/main.xml
Created directory /Users/user/Documents/test/res/drawable-xhdpi
Created directory /Users/user/Documents/test/res/drawable-hdpi
Created directory /Users/user/Documents/test/res/drawable-mdpi
Created directory /Users/user/Documents/test/res/drawable-ldpi
Added file ./AndroidManifest.xml
Added file ./build.xml
Added file ./proguard-project.txt
gradle init
After that I executed gradle init, which returned
:wrapper
:init
BUILD SUCCESSFUL
gradlew tasks
Querying the available tasks with gradlew tasks returns (isn't there missing something?)
:tasks
------------------------------------------------------------
All tasks runnable from root project
------------------------------------------------------------
Build Setup tasks
-----------------
init - Initializes a new Gradle build. [incubating]
wrapper - Generates Gradle wrapper files. [incubating]
Help tasks
----------
components - Displays the components produced by root project 'test'. [incubating]
dependencies - Displays all dependencies declared in root project 'test'.
dependencyInsight - Displays the insight into a specific dependency in root project 'test'.
help - Displays a help message.
projects - Displays the sub-projects of root project 'test'.
properties - Displays the properties of root project 'test'.
tasks - Displays the tasks runnable from root project 'test'.
To see all tasks and more detail, run with --all.
BUILD SUCCESSFUL
Total time: 3.474 secs
My Java version is
java version "1.7.0_60"
Java(TM) SE Runtime Environment (build 1.7.0_60-b19)
Java HotSpot(TM) 64-Bit Server VM (build 24.60-b09, mixed mode)
..and Gradle version (installed via brew) is
------------------------------------------------------------
Gradle 2.2.1
------------------------------------------------------------
Build time: 2014-11-24 09:45:35 UTC
Build number: none
Revision: 6fcb59c06f43a4e6b1bcb401f7686a8601a1fb4a
Groovy: 2.3.6
Ant: Apache Ant(TM) version 1.9.3 compiled on December 23 2013
JVM: 1.7.0_60 (Oracle Corporation 24.60-b09)
OS: Mac OS X 10.9.5 x86_64
What am I missing to be able to build an Android project on the command line?
android create project does not create a gradle friendly structure. It creates an ant friendly structure. You have two options depending on your intentions.
use ant to build your project ( not currently supported by Android team )
use Android Studio to generate a gradle friendly project structure.
num 2 is the recommended approach by the Android team. It's as simple as dl'ing Android Studio and creating a new project. From there you should be able to create a new project that can be built with ./gradlew build
try This:
./android create project -p AppPAKTGV -a Main -k com.example.apppaktgv -t android-23 -g -v 0.11.+
it's works but when i try target 24 or 25 not work i don't now
Try to do this and note
a) you need to type tools/android under Step 3 (like step 2: Execute)
-- but as said the ant structure is not helpful
-- not sure I can go from there
b) I follow the advice and also ensure get the platform-tools
-- I can build
-- I can get that .apk
-- I can adb install (I rename any existing .apk)
Seems working!
I can't build Android + Scala (and IntelliJ Idea 12) project using sbt and sbt-android plugin. I installed everything needed and added ANDROID_SDK_HOME to both .bashrc and /etc/profile but:
me123#ubuntu:~/Documents/android_projects/my-android-project$ echo $ANDROID_SDK_HOME
/home/me123/android-sdk-linux/sdk
me123#ubuntu:~/Documents/android_projects/my-android-project$ sudo echo $ANDROID_SDK_HOME
/home/me123/android-sdk-linux/sdk
me123#ubuntu:~/Documents/android_projects/my-android-project$ sbt
[info] Loading global plugins from /home/me123/.sbt/plugins
[info] Loading project definition from /home/me123/Documents/android_projects/my-android-project/project
[info] Compiling 3 Scala sources to /home/me123/Documents/android_projects/my-android-project/project/target/scala-2.9.2/sbt-0.12/classes...
[error] /home/me123/Documents/android_projects/my-android-project/project/target/scala-2.9.2/sbt-0.12/classes/AndroidEclipse$Transformer.class (Permission denied)
[error] one error found
[error] (compile:compile) Compilation failed
Project loading failed: (r)etry, (q)uit, (l)ast, or (i)gnore? q
me123#ubuntu:~/Documents/android_projects/my-android-project$ sudo sbt
[info] Loading project definition from /home/me123/Documents/android_projects/my-android-project/project
[info] Updating {file:/home/me123/Documents/android_projects/my-android-project/project/}default-6ff5da...
[info] Resolving org.scala-sbt#precompiled-2_10_0;0.12.2 ...
[info] Done updating.
[error] Android SDK not found. You might need to set ANDROID_SDK_HOME or ANDROID_SDK_ROOT or ANDROID_HOME
[error] Use 'last' for the full log.
Project loading failed: (r)etry, (q)uit, (l)ast, or (i)gnore? q
UPDATE:
> android:start-device
[info] Wrote /home/alex/Documents/android_projects/my-android-project/target/scala-2.10/src_managed/main/scala/my/android/project/TR.scala
[info] Compiling 2 Scala sources and 1 Java source to /home/alex/Documents/android_projects/my-android-project/target/scala-2.10/classes...
[warn] there were 4 feature warnings; re-run with -feature for details
[warn] one warning found
ProGuard, version 4.6
ProGuard is released under the GNU General Public License. You therefore
must ensure that programs that link to it (scala, ...)
carry the GNU General Public License as well. Alternatively, you can
apply for an exception with the author of ProGuard.
Reading program directory [/home/alex/Documents/android_projects/my-android-project/target/scala-2.10/classes]
[trace] Stack trace suppressed: run last main/android:proguard for the full output.
[error] (main/android:proguard) java.io.IOException: Can't read [/home/alex/Documents/android_projects/my-android-project/target/scala-2.10/classes] (Can't process class [my/android/project/R$id.class] (Unsupported version number [51.0] for class format))
[error] Total time: 14 s, completed May 30, 2013 3:49:46 PM
First, doing sudo echo $ANDROID_HOME will be exactly the same as echo $ANDROID_HOME, because the variable will be replaced by your shell before executing the command.
Then, you most likely have a permission problem. Try running this to make sure you have the right ones :
$ chmod -Rv 700 /home/me123/Documents/android_projects/my-android-project/
I am new to this maven concept, I am building one android application for which I am want to robospice lib. Rebospice demo example need maven clean install. I installed maven on my ubuntu 12.04
mvn -v
Apache Maven 3.0.4
Maven home: /usr/share/maven
Java version: 1.7.0_10, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-7-oracle/jre
Default locale: en_IN, platform encoding: UTF-8
OS name: "linux", version: "3.2.0-35-generic-pae", arch: "i386", family: "unix"
Then I tried maven clean install on my demo project it gives following error
[WARNING] The POM for com.octo.android.robospice:robospice:jar:1.3.2-SNAPSHOT is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.351s
[INFO] Finished at: Mon Jan 21 15:15:55 IST 2013
[INFO] Final Memory: 10M/124M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project robospice-sample-core: Could not resolve dependencies for project com.octo.android.robospice:robospice-sample-core:apk:1.0.0-SNAPSHOT: Could not find artifact com.octo.android.robospice:robospice:jar:1.3.2-SNAPSHOT -> [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.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException.
Whats the problem behind this.. Need help to solve this problem....
You probably have to configure your maven repositories (You tell maven where to get the dependencies)
OR
Something went wrong the first time you tried to download the artefact.
If this is the later, you can solve the problem by browsing your ".m2" folder and go and see if the corresponding folder contains just metadata files or if it contains the jar and the pom as well. I something looks wrong, you can just delete the folder and retry to build your project.
By the way, it seems that this project "robospice" has a more recent version available (and stable, not snapshot), so you might want to try to use 1.3.1 instead of 1.0.0 SHAPSHOT, if it fits with your project needs.