Getting class cache errors when building with Gradle - android

Trying to start the default Flutter project (the one with the counter). (I was able to do this fine in an old laptop. This is a new machine (Windows) and new setup double checked and all same settings. Not really relevant I suppose but my other Java / Maven stuff all works fine in this machine).
Getting following error:
FAILURE: Build failed with an exception.
What went wrong: Could not open settings remapped class cache for 3gvp67rxesfd2nfkbvtuzjg3o
(C:\Users\abc.gradle\caches\5.6.2\scripts-remapped\settings_eqlrh24ro2w01smdn4qy7bdm6\3gvp67rxesfd2nfkbvtuzjg3o\settings8410a2d21ed2f87c8a0398566330ee52).
Could not open settings generic class cache for settings file 'C:\Users\abc\dev\flutter\myapp\android\settings.gradle'
(C:\Users\abc.gradle\caches\5.6.2\scripts\3gvp67rxesfd2nfkbvtuzjg3o\settings\settings8410a2d21ed2f87c8a0398566330ee52).
BUG! exception in phase 'semantic analysis' in source unit 'BuildScript' Unsupported class file major version 57
Using Geny motion and the Android SDK version is Q (v29). I have tried the project language level for Android to 8, 11 and 13 and all throws same error.
Seen similar issues here and been told to clear gradle cache. Done it at following locations:
C:\Users\abc.gradle (there is a cache folder inside here and deleted
that entire folder)
and inside the Flutter project
myapp\android.gradle (there was a cache folder inside here and
deleted it. There is another folder called 5.6.2 which I didn't touch)
.
I am using Intellij Ultimate. The moment I run it, these folders gets regenerated with the relevant cache stuff and throws same. Does anyone knows how to fix this please?
It is a brand new project and using all latest sdks (android, flutter). Please advice. Thanks.

Turns out it doesn't work with Java 13 (didn't work on Java 11 either). Had to point to Java 8 instead after which I ended up with errors saying I needed to accept licenses.
Go to the location of your Android SDK and run following command to accept licenses.
tools/bin/sdkmanager --licenses
That would do the trick, at least it did for the above issue.

Related

Unity 2018.3 android dex merging issue

Before you decide to dismiss this post as "duplicate" without even reading it, understand that I have looked at a TON of posts related to this topic and I can't find a solution for my instance, including all of the ones that StackOverflow suggested. Most of the posts are for Android Studio instead of unity.
My error is given in Unity when trying to build to android, it crashes here.
CommandInvokationFailure: Gradle build failed.
C:\Program Files\Unity\Editor\Data\PlaybackEngines\AndroidPlayer/Tools\OpenJDK\Windows\bin\java.exe -classpath "C:\Program Files\Unity\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\gradle\lib\gradle-launcher-4.6.jar" org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx4096m" "assembleDebug"
stderr[
D8: Program type already present: com.unity3d.ads.BuildConfig
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':transformDexArchiveWithExternalLibsDexMergerForDebug'.
I've tried changing stuff with a build.gradle file like a lot of posts suggest, but I can't get anything to work.
The error didn't exist in Unity 2018.2. I checked right before I updated, but the update is now throwing this issue.
Does anyone have any UNITY specific ideas what to do here? I've tried so many things and nobody's post has been able to help me yet.
Thanks for any help
You can open the PackageManage under Window in the menu bar and remove Advertisement or you can delete the com.unity.ads file of Library/PackageCache in the project directory to resolve this issue.
This error probably happens when you add a library which is not compatible with your compileSdkVersion.
In your case you can have libs that were not imported by default by unity (and now are)
or there can be a problem with the Build Tools version. (You can try updating them)
I had similar problem a few versions ago, but I don't remember how I fixed it.
I didn't have time to upgrade to unity 2018.3 yet. (So the tips are more like guesses, but it may help you solve the issue.)
My settings (Mac):
- Android Studio 2.3
- Unity 2019.1.5f1:
- Player Settings -> Other Settings –> Scripting Runtime Version = .Net 4
- Package Manager -> Advertisement: Uninstalled
- Preferences -> External Tools -> Android: checked Installed with Unity (everything)
My solution:
- delete GoogleMobileAds from project
- delete PlayServicesResolver from project
- delete Plugins from project
- Import Package -> Custom Package -> GoogleMobileAds.unitypackage (3.15.1 in my case)
Dex Errors generally occur when you have too many methods imported in a project, not because of a specific package. I assume upgrading to new version made you import new stuff to your project.
You need to enable ProGuard.
Cause: http://twinkfed.homedns.org/Android///tools/building/multidex.html
Fix: https://www.youtube.com/watch?v=va0FQNlBUX0

Intellij IDEA 14 - Package R does not exist

Well, I recognize that this has been asked before, but in browsing the other answers:
IntelliJ IDEA - Can't build anything, always get "package R does not exist"
Error: java: package R does not exist
etc.
none of the solutions work.
This is for a project that was building fine until at least the last couple days, so whatever is causing the problem must be new.
Symptoms:
Attempting to to a Build > Rebuild Project fails. I see the step for compiling generates sources go by in the status bar, but the next compilation step fails with the dreaded "java: package R does not exist."
R is found just fine in the IDE, so only compilation fails, suggesting there is a problem with the compilation of the generated sources. This seems borne out by the fact that in the out/production/[module] directory, only some resource files show up, no compiled classes, nothing in the "generated" sbupackage, a no apk file.
Interestingly, when I connect my phone to the computer and try running the application on the device, new changes are picked up, so something is being successfully built somewhere.
Things I've tried:
Per the other threads I've tried:
Doing a full rebuild.
Restarting IntelliJ (including with invalidating caches)
Restarting the computer.
Checking that the gen package is included under sources.
Checking for any Excludes (there are none)
Deleting the stub R file and forcing IntelliJ to regenerate it (which it does promptly)
Confirming that there is an Android facet on the module.
Double-checking that the manifest xml file has not changed and that the referenced activity is correct.
Checked that exclude output path is not checked (it's greyed as I'm inheriting from the project compile path, but I tried switching and manually unchecking it... no luck).
The only recent changes in xml were:
A new item in a menu file. I tried removing it to see if somehow that was an issue even though there were no errors reported, but the problem persisted.
I moved a View class to a subpackage of its prior package. That View class is referenced once in a layout xml and I confirmed that the xml was updated with the new package name.
So at this point I'm out of ideas. Sorry to rehash a somewhat common question.
I have the same problem and it definitely related to last update of the IDE. My version is IU-139.1117.1
Before the update Build -> 'Rebuild Project' was working ok in a windows and a mac installation of the IDE. I updated windows first and 'Rebuild Project' shows the error 'Package R does not exist' even for a new Android project. Same error apeared in mac installation imediately after the update. 'Make project', 'Make module' and 'Compile' commands on the Build menu are all working ok with no error only 'Rebuild project' raises the error.
For a new Gradle Android project everything works ok. It seems something is wrong with last update.
It is reported issue in IDEA 14.0.3 (http://youtrack.jetbrains.com/issue/IDEA-135234).
You can try to Compile Module (Ctrl-Shift-F9) for the module that contains missing R file. It works for me (but I have to do this every time i add/remove items in resources).
don't use Rebuild Project, use Make Project and refresh your project,maybe you should try it a few more times.
Try File | Invalidate Caches. This is solve my problem.
If you cannot wait for a officially stable build, install IDEA EAP 14.0.4 (IntelliJ IDEA 14.0.4 EAP build 139.1408, released on February 20th, 2015) from https://confluence.jetbrains.com/display/IDEADEV/IDEA+14+EAP
I've just solved all issues and rebuild project works again.
Solved with the 14.1 update of intelliJ IDEA, available now.
I had the same issue on a Windows 7 box today with a Java 7 Gradle project, using IntelliJ 14.1.5.
The problem was that somehow the classpath was "too long", but IntelliJ gave me only those strange "java: package foo does not exist" compile error's.
The usual tricks (see also above) did not help.
The workaround was to shorten the classpath a bit, in my case setting GRADLE_USER_HOME to c:/.gradle (was before c:/users/myusername/.gradle). After resyncing the gradle project everything worked fine.
The problem was therefor obviously IMO some kind of windows filesystem path length restriction.

getting error during project creation using phonegap-2.5.0

i have installed android sdk and downloaded the latest version of phonegap 2.5.0 in fedora 18.
i am trying to create a project using the following command
./create ~/Desktop/android-project com.example.android android_project
am getting the following error.
which: no android in (/sbin:/bin:/usr/sbin:/usr/bin)
An unexpected error occurred: ANDROID_BIN="${ANDROID_BIN:=$( which android )}" exited with 1
need your valuable suggestions.
finally found the answer
After checking my .bash_profile paths, and a bunch of digging, I finally found the cause of the issue. If you open up the create file (phonegap-2.5.0/lib/android/bin/create), there is a line that lists ANDROID_BIN=”${ANDROID_BIN:=$( which android )}”. The “which android” is the cause of the issue (or at least it seemed to be in my case). If you replace this line with the full path to your android tools (as listed below) it should resolve the issue. My final line looked like this:
ANDROID_BIN=/Users/ktyacke/DEV/adt-bundle-mac-x86_64-20130219/sdk/tools/android
The message you have means the phonegap script cannot find the android binary, which is included in the SDK you downloaded. Add the binary's directory, as well as the android tool's directory, to your path defined in ~/.bash_profile or any other location you're initializing the shell's environment variables.

Libgdx setup UI gives 2 unexpected errors in new GWT project

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

Proguard ParseException with Default proguard.cfg on Android

I am about to release an application but, while i was building it using Export Tool of Android SDK in Eclipse, i get the error below.
I didn't change the proguard.cfg.
It is in the root folder of my project.
I only add proguard.config=proguard.cfg to default.properties.
I read the forum and update proguard (just copied the files to the tools folder of Android SDK), but still I doesn't work. I couldn't figure out what the problem is with the 'Projects\Eclipse' ??
If you help me, I will be so glad...
[2011-08-08 02:32:46 - CoolProject] Proguard returned with error code 1. See console
[2011-08-08 02:32:46 - CoolProject] proguard.ParseException: Unknown option 'Projects\Eclipse' in argument number 9
[2011-08-08 02:32:46 - CoolProject] at proguard.ConfigurationParser.parse(ConfigurationParser.java:172)
[2011-08-08 02:32:46 - CoolProject] at proguard.ProGuard.main(ProGuard.java:484)
Yeah that is right, but also I did something that I didn't know :)
My solution was:
I updated to latest Android SDK.
I changed SDK path property under Eclipse: Window > Preferences > Android > SDK Location as something like c:\Progra~1\android-sdk. The Progra~1 can be used for writing Program Files witout spaces. You can use DIR /X command in command prompt on Windows to get no space versions of Paths.
I moved my Eclipse Workspace to a location without spaces like D:\
The changes above didn't enough to solve the problem. I got "Conversion to Dalvik format failed with error 1" error dialog witout any explanation on output console. Then I found that topic and did what that reply says.
Then it worked ;)
I am using Windows 7 Ultimate x86. I hope it works for others too.
Arda.
Your project path probably contains a space. This should be fixed in the latest version of the Android SDK (at least for the Ant build). Otherwise, you should use a path without spaces for the time being.

Categories

Resources