Build Problem with AnysoftKeyboard (Android) - java

I am trying to build AnysoftKeyboard in Android studio.
I have java 9(jdk 9) and the appropriate ndk (android-ndk-r14b), as the creator in GitHub says.
I have also changed the local.properties file to shows to the correct paths.
Nevertheless I am still getting some errors.
You can find below those errors.
Run tasks error :
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':base:compileDebugJavaWithJavac
java compiler errors : Caused by: java.lang.BootstrapMethodError: java.lang.NoClassDefFoundError: com/sun/tools/javac/util/JavacMessages$ResourceBundleHelper
Caused by: java.lang.NoClassDefFoundError: com/sun/tools/javac/util/JavacMessages$ResourceBundleHelper
Caused by: java.lang.ClassNotFoundException: com.sun.tools.javac.util.JavacMessages$ResourceBundleHelper
Here is a screenshot of the error :
AnySoftKeyboard Compile Error , Run Tasks Error
The project uses gradle, in which I am not familiar with, so if I have missed any important step-point, please guide me to solve it.
Is there something that I am missing and getting these errors? What should I do? Thanks in advance.

After following just the official documentation I successfully built a project. I think you just forget with setting JAVA_OPTS with adding java.se.* source as mentioned below. And that is why you have it in stacktrace error above, with missing java.se. resources.
To develop this project, you'll need:
Java 10 - get OpenJDK or AdoptOpenJDK.
Make sure you have the environment variable JAVA_OPTS='-XX:+IgnoreUnrecognizedVMOptions --add-modules java.se.ee'. This is required to ensure the JVM is merciful with libraries that were not designed for Java9+ JVMs.
git
Android Studio
Android SDK API Level 28 installed. Set up local.properties file to point to it (that is, ensure you have sdk.dir=/path/to/android/sdk in it).
Android NDK r14b installed. Set up local.properties file to point to it (that is, ensure you have ndk.dir=/path/to/android/ndk in it).

Caused by: java.lang.BootstrapMethodError: java.lang.NoClassDefFoundError: com/sun/tools/javac/util/JavacMessages$ResourceBundleHelper
TO remove this error comment below line prone error.

Related

Unsupported class file major version 59 in Android Studio with ReactNative

i'm trying to reBuild and compile my Android Studio project, it worked good before installing the new version of react-native-jumio-mobilesdk for react native. After upgrading that library to 3.9.1, i had this error and i have not been able to fix it.
> Task :react-native-jumio-mobilesdk:compileDebugKotlin FAILED
Execution failed for task ':react-native-jumio-mobilesdk:compileDebugKotlin'.
Could not resolve all files for configuration ':react-native-jumio-mobilesdk:debugCompileClasspath'.
Failed to transform bcprov-jdk15on-1.67.jar (org.bouncycastle:bcprov-jdk15on:1.67) to match attributes {artifactType=android-classes-jar, org.gradle.category=library, org.gradle.libraryelements=jar, org.gradle.status=release, org.gradle.usage=java-api}.
> Execution failed for JetifyTransform: C:\Users\UsuarioDA1.gradle\caches\modules-2\files-2.1\org.bouncycastle\bcprov-jdk15on\1.67\8c0998045da87dbc2f1d4b6480458ed811ca7b82\bcprov-jdk15on-1.67.jar.
> Failed to transform 'C:\Users\UsuarioDA1.gradle\caches\modules-2\files-2.1\org.bouncycastle\bcprov-jdk15on\1.67\8c0998045da87dbc2f1d4b6480458ed811ca7b82\bcprov-jdk15on-1.67.jar' using Jetifier. Reason: IllegalArgumentException, message: Unsupported class file major version 59. (Run with --stacktrace for more details.)
Please file a bug at http://issuetracker.google.com/issues/new?component=460323.
I have one entire week trying to fix it but so far I have not been able.
I appreciate your help. :D
For me the issue occured when I tried to update the firebase crashlytics gradle plugin to 2.7.1.
It was possible to fix it by setting android.jetifier.blacklist=bcprov-jdk15on in gradle.properties as mentioned here.
Try this :
clear project cache
upgrade packages for ex. in flutter we use flutter pub get
add :
android.jetifier.blacklist=bcprov-jdk15on
to your gradle.properties file and rebuild the project. if not resolved please refer to similar issue on github and google

ERROR: A JNI error has occurred, please check your installation and try again.NoClassDefFound error: DRPCExecutionException

When I am trying to connect to storm-topology(v1.0.2) throuch DRPC client request I am getting the following error:
ERROR: A JNI error has occurred, please check your installation and try again.
exception in thread "main" java.lang.NoClassDefFoundError:org/apache/storm/generated/DRPCExecutionException
First problem you have is that Apache Storm is missing from classpath. If you are using Maven, here are example coordinates to put in pom.xml - or alternatively you may need to dowload JAR-files from website and put them inside libraries directory. Then you might start to get more meaningful error message. Maybe you need to define JNDI resource?
This (JNI error) is very common error, it occurs when you change your jdk version. To solve this error you have to change the compiler setting only. Just right click on project and go to properties then go to java compiler and then select compiler compliance level to your JDK version....that's it, done!

Project Not working after updating to API 23

Can anyone please help me with this? I dont know what does this mean.
To give you a back up I updated my sdk with 23 and then i got 101 errors regarding HTTPClient not being resolved. So i followed this link to remove that then I have this error of which i have no clue where to start with.
Error:Execution failed for task ':app:dexDebug'.
com.android.ide.common.internal.LoggedErrorException: Failed to run command:
C:\adt-bundle-windows-x86_64-20140702\adt-bundle-windows-x86_64-20140702\sdk\build-tools\23.0.1\dx.bat --dex --no-optimize --output F:\sagarDevanga\workspace\AndNrby\app\build\intermediates\dex\debug --input-list=F:\sagarDevanga\workspace\AndNrby\app\build\intermediates\tmp\dex\debug\inputList.txt
Error Code:
2
Output:
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define Lorg/apache/http/ConnectionClosedException;
at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596)
at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554)
at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535)
at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)
at com.android.dx.merge.DexMerger.merge(DexMerger.java:189)
at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:502)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:334)
at com.android.dx.command.dexer.Main.run(Main.java:277)
at com.android.dx.command.dexer.Main.main(Main.java:245)
at com.android.dx.command.Main.main(Main.java:106)
Make sure that your adt supports the version of api that you are running. See this link : https://developer.android.com/tools/support-library/index.html
To fix you should check in libs (.jar) and in your build.gradle if there are some libraries duplicated. This error happen tipicaly when you add a copy of the same library or a library that include a copy of another library that you have already added
Update also your support libs from SDK
Ok I have updated the question's title also so that other people also find it useful.So I will write a detailed answer about how this error occured in my project and the fixes I did and how I finally derived the answer.
1) I updated the SDK and then started to compile my project using the latest api i.e API 23. You can do that by going to File -> Project Structure ->Select your module.
Now in the right hand side window under properties the top two properties can be changed using in the drop down.
Then click on Apply and Ok.
2) So when you do this your app's build.gradle file will look like this. And now everything looks good. It will compile also. But when you run the project you will get a lot of errors by this name Error:(17, 35) error: package org.apache.http.impl.client does not exist Obviously if you are using them in your async tasks.
3) So when i got this error I did a lot of research here and there and then came across this link and added the HTTP CLIENTS jar files in the libs folder and then tried to run the program I ended up with this problem (problem mentioned in the question).
4) So after diggin around I found that the problem was HTTP methods which i used in the Async task were deprecated in the API 23 hence I landed myself in this mess.
5) Then what I did next fixed the problem for me. Refernce given here.
6) In your module's build.gradle file add this line useLibrary 'org.apache.http.legacy' like below.
7) Wait your still not done. Now go to your main build.gradle file and add this line classpath 'com.android.tools.build:gradle:1.3.1' like this . Now build and compile your project everything runs fine.
8) After all this steps the project works fine but I have a doubt in the last pic that i shared which is of the top level build.gradle file. Whether I should keep both the classpaths or just use this classpath 'com.android.tools.build:gradle:1.3.1' and remove the other one. If any one have any idea on this please help.
9) The problem was that they deprecated the HTTP Clients in the Latest Android API 23. Insted of HTTP Client you have to use HttpUrlConnection but if you want to continue using HTTP client for NOW follow the steps above.

Android Studio - Resource Entry already defined

After compiling my Android application using the Android Studio (Beta), I have the following error:
Error:error: Resource entry background is already defined.
res\drawable-xhdpi-v4\background.9.png:0: Originally defined here.
This occurred when I had a image file called "background" in my res folder.
I then made a 9 patch version of it and pasted it in the same folder. This meant that there was 2 files with the same name. So I unsurprisingly I had this error.
However I now deleted all instances of the background image file (including the 9 patch version and original image) in my code and layout file and I still have this error.
You could try to do one of the following:
Clean and Build or gradle clean build assemble
Invalidate and restart Android Studio
1 Build > Clean Project
2 Build > Rebuild Project
I am using Android studio and I run exactly into the same issue and none of the answers I found on the web helped me solve the problem, including the previous one. So reading through all details of the error messages and found this lines:
Error:Execution failed for task ':app:processDebugResources'.
com.android.ide.common.internal.LoggedErrorException: Failed to run command:
C:\Users\user\AppData\Local\Android\android-studio\sdk\build-tools\android-4.4W\aapt.exe package -f --no-crunch -I C:\Users\user\AppData\Local\Android\android-studio\sdk\platforms\android-20\android.jar -M C:\Users\user\AndroidStudioProjects\DartsApp\app\build\intermediates\manifests\debug\AndroidManifest.xml -S C:\Users\user\AndroidStudioProjects\DartsApp\app\build\intermediates\res\debug -A C:\Users\user\AndroidStudioProjects\DartsApp\app\build\intermediates\assets\debug -m -J C:\Users\user\AndroidStudioProjects\DartsApp\app\build\generated\source\r\debug -F C:\Users\user\AndroidStudioProjects\DartsApp\app\build\intermediates\libs\app-debug.ap_ --debug-mode --custom-package com.dartstransit.dartsapp -0 apk --output-text-symbols C:\Users\user\AndroidStudioProjects\DartsApp\app\build\intermediates\symbols\debug
Error Code:
1
Output:
res\drawable-hdpi-v4\bus_w.png:0: error: Resource entry bus_w is already defined.
res\drawable-hdpi-v4\bus_w.jpg:0: Originally defined here.
As you can see there are two files of name bus_w with different extensions on the same folder. I had already removed those files from the project and still getting the error, so I decided to check every single folder of the project that was reference in the compiler line in the error message. Finally found that there was a copy of the file bus_w.png in the folder app\build\intermediates\res\debug\drawable-mdpi-v4.
I just deleted it and voila, problem solved.
A simple Build > Rebuild project helped me
Did you try rename this file to other name? It seem one of your libraries have same resource.
I see that many devs(include me) had issue with ic_launcher too. I think you want to try mipmap instead drawable. So we will have something like this:
\res\mipmap-hdpi
\res\mipmap-mdpi
\res\mipmap-xhdpi
\res\mipmap-xxhdpi
Hope this help.
I have also encountered this error recently.Here is my solution that works,hope it will help you.
1.only keep 9 patch version image in the drawable-hdpi folder
2.make sure the code related to this problem in xml file remains the same: android:background="#drawable/msg_left"
instead of using the code:
android:background="#drawable/msg_left.9"
PS:My original image name is msg_left,and my 9 patch version image name is msg_left.9
I did the trick by moving the icon
drawable/ic_launcher
to
mipmap/ic_launcher
and it worked fine :)
In my case the problem was that I had more than one '.' in the filename. like:
a.png
a.bold.png
Solution was to rename to
a.png
a_bold.png
In our case, problem started occurring (error shows 'duplicate value for resource' in a library) when some other library was upgraded to it's latest version.
We just downgraded the version of the library that was upgraded.
Real pain was because that we have many dependencies which can be dynamically upgraded when there is a new version available in repositories. So my teammate had to go through all libs that can be dynamically upgraded and see if there is one that is recently upgraded, try to downgrade it and check if build goes fine. He identified many were upgraded on previous day. Downgrading one of them got the build back.
Conclusion we made is not to use Dynamic Versioning. Don't use dynamic versions for your dependencies.
This was the error by the way:
Task :app:generateDebugResources UP-TO-DATE
AGPBI: {"kind":"error","text":"error: duplicate value for resource \u0027attr/itemBackground\u0027 with config \u0027\u0027.","sources":[{"file":"/Users/unknownuser/.gradle/caches/transforms-1/files-1.1/singledateandtimepicker-1.2.2.aar/86ae3786d70c769e610c8a01d58aa638/res/values/values.xml","position":{"startLine":15,"startColumn":4,"startOffset":2427,"endColumn":48,"endOffset":2471}}],"original":"","tool":"AAPT"}
AGPBI: {"kind":"error","text":"error: resource previously defined here.","sources":[{"file":"/Users/unknownuser/.gradle/caches/transforms-1/files-1.1/singledateandtimepicker-1.2.2.aar/86ae3786d70c769e610c8a01d58aa638/res/values/values.xml","position":{"startLine":15,"startColumn":4,"startOffset":2427,"endColumn":48,"endOffset":2471}}],"original":"","tool":"AAPT"}
Task :app:mergeDebugResources FAILED
Error: java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: AAPT2 error: check logs for details
FAILURE: Build failed with an exception.

Where do I get the missing resources?

I am still unable to get the box-api hello world program to work. I was getting this error:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/lang/NotImplementedException
at TestProgram.getAuthenticatedClient(TestProgram.java:47)
at TestProgram.main(TestProgram.java:35)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.lang.NotImplementedException
...
I then went to the Apache Commons Lang Home and downloaded and set up their thing.
Now I get
Exception in thread "main" java.lang.NoClassDefFoundError: com/fasterxml/jackson/databind/ObjectMapper
at com.box.boxjavalibv2.jacksonparser.BoxResourceHub.<init>(BoxResourceHub.java:28)
at com.box.boxjavalibv2.BoxClient.createResourceHub(BoxClient.java:345)
at com.box.boxjavalibv2.BoxClient.<init>(BoxClient.java:65)
...
and I have no idea how to fulfill that dependency. I also suspect that even if I could find this one, there'd just be another one, and another one, and another one. Manually importing them all does not seem to be very realistic.
How am I intended to get the missing dependencies for the box API?
The SDK comes included with all of the dependencies you should need. You can find them all in the libs directory of the SDK..
Add all of those jars to your Eclipse build path and it should work.

Categories

Resources