I'm trying to build a project in Android Studio that targets API16 (Android version 4.1.2). Using the SDK manager I was able to download that SDK platform but an exception is raised at compile-time as it's trying to parse a compiled .jar file:
bad class file magic (cafebabe) or version (0034.0000)
My understanding of this issue is that I need the build tools to match the API version I'm targeting (since I currently only have the most recent version of the build tools). However, I am unable to install them because they're unavailable in both the SDK manager and on the Android website (http://developer.android.com/tools/revisions/build-tools.html). Is there another way to install this version of the build tools? (Alternatively, if installing that version of the build tools is unnecessary, how do I resolve this issue?)
This is a problem with the Java version (i.e. the version the jar, or rather the class files inside it, was compiled with). It actually has nothing to do with the Android version.
0x34 means the jar was compiled with Java 8 (see the list of possible values here). Android can only use jars compiled as Java 6.
If you have the sources for this library, you should recompile it again with the -target 1.6 flag.
Related
I am trying to build an old project and something has changed where the project tries to target mips64el-linux-android. I don't reference this build targets within in build variants and it's not the sdk build version I specify in the project properties panel. Even so, I do have the native sdk installed so it should build in this case.
Any ideas?
1.Donwload NDK package
2.Open the "toolchains" folder after unzipping
3.Compare with android-sdk->ndk-bundle->toolchains folder
4.Find the missing folder and copy it in the past
5.Recompile
Which NDK version are you using? Google has dropped mips support in NDK r17.
You need to download older NDK for older projects. I use NDK r10e and sometimes r14 for my older projects. If project is too old you can try with r10.
In your project build script you need to specify downloaded NDK's path. You need to download and manually extract NDK (I believe Android Studio will not download older version).
I have an android library project that builds lib.aar artefact and an app project that imports this lib.aar after it was built. lib.aar requires NDK 17 to be built since it has some C++ 17 code.
I manage to build .aar file successfully but the app fails to compile with this message:
A problem occurred starting process 'command '/Users/user/Library/Android/sdk/ndk-bundle/toolchains/mips64el-linux-android-4.9/prebuilt/darwin-x86_64/bin/mips64el-linux-android-strip''.
This is caused by the fact that NDK 17 removed support for MIPS and I can't upgrade to a newer version of android studio that uses NDK 18beta
If I remove the content of '/Users/user/Library/Android/sdk/ndk-bundle' folder, deleting the NDK, then the app builds without errors and I can use lib.aar code inside the app.
So far I've tried this: How do I disable the NDK build in Android Studio 1.0.1 , this https://gist.github.com/ph0b/9e59058ac59cac104398 . Setting env variable ANDROID_NDK_HOME to a dummy folder works, the app builds, but it's kind of a hack.
Is there any way to programmatically disable NDK build for the app project without deleting NDK folder?
This is caused by the fact that NDK 17 removed support for MIPS and I can't upgrade to a newer version of android studio that uses NDK 18beta
r18 won't fix this problem either; it still doesn't have mips support. The fix to the problem is upgrading the gradle plugin version in your application to at least 3.1, which is the minimum required for NDK r17 (and, extremely unfortunately, is required for even having the NDK installed for some reason).
The other solution here would be to install NDK r16b somewhere and then point at it from the app's local.properties, letting the aar pick from the SDK. If you're just working on a local build this will work, but since local.properties shouldn't be checked in to version control it won't help others much.
How do I put it to QMake to correctly generate the Makefiles to use the android platform-version I desire? I am trying to use NDK 14b with platform 21, however QMake always generates makefiles which target version 16 (which misses the stuff I need).
I'm using Qt 5.9.1 with Qt for Android Extras. I'm building to Android, armabiv7a with GCC 4.9. I am on Android NDK version 14b (which is a bit older, but definitely has support for platform 21).
I have specified
The sysroot for the Android Kit points to the folder for android-21
The android build SDK is android-26
There is an android manifest file. It sets the minimum required SDK to API 21, the Target SDK to API 24.
Qt Creator does not voice any qualms about the Kit (although I am suffering from the issue that it spam-generates defunct android kits en masse, but I do not believe this to be related to the problem I'm having here).
Am I missing something here?
The trick is to set the environment variable ANDROID_NDK_PLATFORM to android-21 this can be done in Qt Creator in the project tab. I had to force a clean after doing this before it worked.
I followed the steps shown here.
Installed JDK, Android SDK and NDK. Installed gradle, ant and OpenGl libraries.
When trying to build any android example I get the following error:
Error: Target id 'android--1' is not valid.
I tried this solution but I couldn't select any API. The paths are all correctly set. Using NDK 10 since 14 has known issues.
I verified that it is not a timeout issue as described here
Anyone encountering the same issue?
The reason for not building is this:
SDK Tools, Revision 25.3.0 (March 2017)
Obsolete/deprecated tools have been removed:
android
QtCreator is using the tools to get information about the Android SDK. Workaround is to get the previous version (e.g. 25.2.5).
If i have two or more version of android sdk build tools as shown below then when which one will be chosen by the eclipse while building. IS it anything to with the SDK platform chosen for developing apk.
Here which one will be used either 17 or 19?
The build tools specifies the toolchain used to build Android projects. In Eclipse you can change which version is used with the project.properties file by specifying sdk.buildtools, e.g.
sdk.buildtools=17.0.0
You will probably never need to do that, as it will use the most recent installed version by default. It is not tightly coupled to the SDK version, and has only been recently split apart from the SDK itself (since version 17).
If there are different versions for Android SDK Build Tools , By default eclipse uses the most recent version of the Android Build Tools.
But if your project requirement belongs to different version(may be older) , you can do this using following steps.
In the root folder of your application project, find the project.properties file.
Open the file and specify the Build Tools version by adding a build-tools property on a separate line:
e.g. sdk.buildtools =17.0.0