开发者

Maven is looking in the wrong directory for the Android tools - how can I correct this?

开发者 https://www.devze.com 2023-03-31 17:39 出处:网络
I\'ve been following the instructions here - I want to build the helloworld.apk, and generally get started with Android/Maven development.

I've been following the instructions here - I want to build the helloworld.apk, and generally get started with Android/Maven development.

https://github.com/akquinet/android-archetypes/wiki

Any time I try to compile I get the following error message:

Embedded error: ANDROID-040-001: Could not execute: Command = /bin/sh -c cd /home/sal/workspace/foo5 && /home/sal/opt开发者_Python百科/android-sdk-linux_x86/platforms/android-8/tools/aapt/package -m -J /home/sal/workspace/foo5/target/generated-sources/r -M /home/sal/workspace/foo5/AndroidManifest.xml -S /home/sal/workspace/foo5/target/generated-sources/combined-resources/res -I /home/sal/opt/android-sdk-linux_x86/platforms/android-8/android.jar, Result = 127
[INFO] ------------------------------------------------------------------------

It's looking for the aapt utility in an obsolete location. I seem to remember that older versions of the Android SDK had a tools directory for each platform available. This was changed so that there's a sharared tools and platform-tools folder.

How do I make maven use the correct folders.

One solution is simply to copy all the tools into one messy folder, but surely there's a more elegant way of doing this?

Update 0: I already have the SDK path set...

<properties>
    <outputDirectory>target/classes</outputDirectory>
    <!-- Path to the sdk in the file system -->
    <sdkPath>/home/sal/opt/android-sdk-linux_x86</sdkPath>
</properties>


The best way to do this is to set the ANDROID_HOME environment variable. Then you do not need to set anything in the pom.xml file

If you insist on using the pom you have to set the sdk.path variable in the configuration element of the maven android pluginn and not as a general property.

And if you still have trouble ask on the maven android developer mailing list.

The other thing you should check is that you use a latest version of the plugin.


If it generates configutation for maven-android-plugin, try to set:

<properties><sdk.path>...</sdk.path></properties> 
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号