I am trying to update an older Xamarin.Android codebase. I was using a pre-API 21 target and now trying to update to API 24 (Android Nuget). I think I have resolved the majority of the compatibility issues, but one is troubling me. When I do a build I get the following error.
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets: Error: Tool exited with code: 10. Output: Error: Can't read [/Library/Frameworks/Xamarin.Android.framework/Versions/7.0.2-37/lib/xbuild-frameworks/MonoAndroid/v7.0/mono.android.jar] (Can't process class [android/app/ActivityTracker.class] (Unsupported class version number [52.0] (maximum 51.0, Java 1.7)))
After doing some Google searching I found that the majority of people who are having this issue are using Java 1.8, as am I. Apparently, the bundled version of ProGuard does not support Java 1.8 byte code. I have manually installed the latest version of ProGuard (5.3.1) over the packaged version in the folder below.
~/Library/Android/sdk/tools/proguard
Unfortunately I am still having the same error. I am also using the latest version of the following packages (see screenshot).
Does anyone have any idea how to resolve this build issue?
For this particular error message I had turned out the issue was I installed ProGuard in the wrong place. I originally installed ProGuard in ~/Library/Android/sdk/tools but instead needed to be in ~/Library/Developer/Xamarin/android-sdk-macosx/. This resolved that build error.
Just download the latest version of proguard from the this link;
Unzip the content to a folder called proguard;
Replace the folder ~/Library/Developer/Xamarin/android-sdk-macosx/tools/proguard with the folder from the previous step.
Related
I have a project that has started throwing this error when building in Android Studio or Gradle:
com.android.tools.r8.ApiLevelException: MethodHandle.invoke and MethodHandle.invokeExact are only supported starting with Android O (--min-api 26)
Now I assume that it's related to use of Java 8 features, perhaps a lambda, but the error message gives no clue as to where the problem lies - it could be my code or it could be a library.
What's the best way to find out where the offending code is? It's a reasonably large app with several modules and quite a few libraries.
In my case i tried to mock something via mockk in an instrumentation test running Api Version 26 or higher, removing the dependency was my only solution as long as following issue is not resolved: https://github.com/mockk/mockk/issues/281
Update: It seems that the issue got resolved and using mockk version 1.10.0 will resolve this issue
One approach would be to set your min api to 26, to avoid the error and build the apk, and then inspect the bytecode of the app (dexdump, baksmali, etc.) to find any usages of the MethodHandle class.
Looking through the error log, it did give a bit more information, specifically nominating one jar file that it failed on:
/Users/.../androidApp/build/intermediates/transforms/desugar/debug/41.jar
On examining that jar file, the classes were all from a library recently added to the project, and the very first class listed was:
META-INF/versions/9/org/h2/util/Bits.class
This turns out to be a Java 9 customised class. Deleting it from the jar file (using zip -d) solved the problem.
Just change the mockk version to 1.10.0, this will resolve the
I have same case when used too high version of Mockito library.
The solution was downgrading from 3.8.0 to 3.4.6. and everything started to work properly.
Error occurred for:
org.mockito:mockito-android:3.8.0
but work for:
org.mockito:mockito-android:3.4.6
We need to update the java version to java 8.
For that please click on File -> Project structure -> app (under Module folder) -> Then select the source compatibility and target compatibility to java 8.
After that you might encounter another error with MethodHandle.invoke and MethodHandle.invokeExact, if you get this error then set the minSdkVersion to 26 or higher
I'm trying to install and test the andgram application available at https://github.com/markchang/android-instagram.git
But, some layout files show the following message and Eclipse doesn't generate the R.java file:
NOTE: This project contains resource errors, so aapt did not succeed, which can cause rendering failures. Fix resource problems first.
Couldn't resolve resource #style/ActionBar
I thought it was the SDK version, but I have the version 8 installed and it doesn't solve the problem.
I would appreciate any help.
Thanks!
The library you are trying use depends on the android-actionbar library. Have you downloaded that library and added it as a library project to your project?
Edit:
FYI, The actionbar library it depends on is outdated (2+ years).
You have change your build target to at least API 11 in order to support the ActionBar.
I am new to Android development. I have succesfully installed eclipse with Android Developer Tool plugin and many of the samples work fine.
But Android samples - Accelerometer and APIDemos do not build. I see many build errors notifying to fix the errors in code. I dont think Google has released APIDemo sample with build errors.
Thanks in advance, please advice how to fix these errors, or if any configuration/setting is required.
I have set the Java compiler compliance level to 1.6.
Error information(for acceralometer sample):
The project contains error(s) in application. Please fix them before running
Error details:
The method onAccuracyChanged(Sensor, int) of type AccelerometerPlayActivity.SimulationView must override a superclass method
AccelerometerPlayActivity.java /AccelerometerPlay/src/com/example/android/accelerometerplay line 456
Java Problem
Call requires API level 8 (current min is 5):
android.view.Display#getRotation AccelerometerPlayActivity.java /AccelerometerPlay/src/com/example/android/accelerometerplay
line 389 Android Lint Problem
Regards,
Jai
Look for the line androidminSdkVersion ="5" in your android.manifest file
and change its value from 5 to 8 or anything more than 8
Alternative is
Go to project properties by right clicking on you project,
thereafter look for Android in properties.
You have to select the build target here equivalent to the api for which it the sample project is build for
Refer Image
Say if you are using the sample from folder android-12 then you have to check the same option(ie API Level 12) here in properties
A possible reason can be a slow PC, which does not build in time. Then errors occur due to absence of R.java
In that case (errors are with something like R.id.stuff), build the project and wait.
I found the fix myself!
Earlier I tried with Andriod version 4.0. Now I just tried ApiDemos sample with Android version 4.1.2. It worked fine. I also deployed the apk in my mobile. It just works fine.
I have run the setup ui, however, I get two different errors in the -html project than what is described in the tutorial: libgdx tutorial
The tutorial error stated is as follows (which is an error I do not see):
To fix the error of the HTML5/GWT project, go to the "Problems" view, right click the error message "The GWT SDK JAR gwt-servlet.jar is missing in the WEB-INF/lib directory" and select "Quick Fix". Click "Finish".
The errors I have are:
The project was not built since its build path is incomplete. Cannot find the class file for com.google.gwt.core.client.EntryPoint. Fix the build path then try building this project ...
The type com.google.gwt.core.client.EntryPoint cannot be resolved. It is indirectly referenced from required .class files
Is there anyway i can fix this? I just updated my eclipse, I also downloaded Version 18 ADT, revision 19 for Android SDK Tools, and revision 11 for Android SDK Platform-tools.
I had the same problem a couple of weeks ago and got around it by installing the GWT SDK.
I know that the post is old, but while the answer of #Rod was close to resolve my problem, it didn't fully. After installing the plugin in his answer I got 3 error messages instead of two: the same previous ones and a new one.
Looking inside the class that was giving the problem made Eclipse to point straight to the problem: the compiler compliance required to be 1.5 or greater but Eclipse had by default 1.4. I changed it through Window > Preferences > Java > Compiler > Compiler compliance level, where I put the correct one, 1.7, and everything compiled cleanly.
PS: Thanks #Rod
use the http://dl.google.com/eclipse/plugin/4.2 to install plugin on eclipse
instead of http://dl.google.com/eclipse/plugin/4.4 or 4.3
although there are many questions with a similar title, I could not find the solution to this issue.
I have an Android project in Eclipse which references ActionBarSherlock 4.0.2 as Android library. In addition, I have added the JARs for ACRA and Google Analytics in the /libs folder. The support v4 jar is taken from ABS libs.
The project's Java Build Path looks like this
When exporting through the wizard I get the "Conversion to Dalvik format failed with error 1" error.
Cleaning, removing all Android Dependencies and clicking on Fix Project Properties and cleaning does all not work.
Any idea?
EDIT:
I missed some info: I'm doing this on Mac OS 10.6.8, Eclipse Indigo, Android SDK Tools r19 and ADT plugin v18.
project.properties file includes the proguard.cfg file: commenting it does avoid the issue.
I actually managed to overcome the issue, here soem details if they can be of use to anybody:
I first tried everything from clean to close/reopen project etc etc etc
I finally too the latest beta of proguard from http://sourceforge.net/projects/proguard/files/ and replaced the /lib folder in android-sdk-macosx/tools/proguard with the one from the beta version (proguard4.8beta1) and .. it works!
I had the same issue after updating to ADT 20 (released with Jelly Bean), and similarly, all the old solutions (clean, rebuild, etc.) didn't help. Taking a clue from omoling's answer, I updated my Flurry jar to the latest from their website... and the problem cleared up.
So, if you're having this problem, try updating any/all external libraries that your project uses.