java.lang.RuntimeException: org.gradle.api.internal.provider.MissingValueException - java

I am trying to build an android project, but it is showing the following errors:
Caused by: java.lang.RuntimeException: org.gradle.api.internal.provider.MissingValueException: Cannot query the value of this provider because it has no value available.
Caused by: org.gradle.api.internal.provider.MissingValueException: Cannot query the value of this provider because it has no value available.
Caused by: com.android.builder.errors.EvalIssueException: Failed to install the following Android SDK packages as some licences have not been accepted.
I am using Android version 2020.3.1 (Arctic Fox) and Gradle version 6.8.3. Can someone please suggest to me what should I do to solve it?

Related

"java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema" when accepting SDK licenses

Alright so I'm trying to build my React-Native app using Android Studio. I first ran into this error when building:
Failed to install the following Android SDK packages as some licences have not been accepted.
build-tools;29.0.2 Android SDK Build-Tools 29.0.2
To build this project, accept the SDK license agreements and install the missing components using the Android Studio SDK Manager.
Alternatively, to transfer the license agreements from one workstation to another, see http://d.android.com/r/studio-ui/export-licenses.html
Using Android SDK: C:\Users\jaspe\AppData\Local\Android\Sdk
When figuring that out I came across this answer which told me to accept the licenses. However in trying to do so I got the following error:
C:\Users\jaspe\AppData\Local\Android\Sdk\tools\bin>sdkmanager --licenses
Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema
at com.android.repository.api.SchemaModule$SchemaModuleVersion.<init>(SchemaModule.java:156)
at com.android.repository.api.SchemaModule.<init>(SchemaModule.java:75)
at com.android.sdklib.repository.AndroidSdkHandler.<clinit>(AndroidSdkHandler.java:81)
at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:73)
at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:48)
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.annotation.XmlSchema
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
... 5 more
To resolve which I found this post. I don't use brew, but I tried the second answer. It didn't work, sadly enough. Then I found out I didn't have a JDK installed, so I did that. But with the newest JDK installed I still get an exception:
C:\Users\jaspe\AppData\Local\Android\Sdk\tools\bin>sdkmanager.bat -licenses
Error occurred during initialization of boot layer
java.lang.module.FindException: Module java.xml.bind not found
And now I'm not sure what to do anymore. I found an answer explaining I needed to edit my project settings, but I think this doesn't apply to my project, and honestly I'm in a bit over my head. Does someone have experiences with these errors, and can help me fix them? I've spent the whole morning trying to figure this out, I'd expected building a runnable .APK as a demo would be easier...
You are using the wrong sdkmanager, tools directory has been deprecated
Open Android Studio and install the latest command-line tools:
This will create this folder in your Android SDK:
...\Android\Sdk\cmdline-tools\latest\bin
Now use the sdkmanager which is inside the bin directory to accept all the licenses:
C:\Users\jaspe\AppData\Local\Android\Sdk\cmdline-tools\latest\bin>sdkmanager.bat --licenses
#MatPag's answer has the solution I needed, but it took me a while to recognise it. Posting this answer for a specific case incase it helps someone else.
I was trying to setup Unreal Engine v4.25.4 when I encountered this error. I needed to run a batch script that came with Unreal Engine located at:
C:\Program Files\Epic Games\UE_4.25\Engine\Extras\Android\SetupAndroid.bat
which produced the error:
Android Studio Path: C:\Program Files\Android\Android Studio
Android Studio SDK Path: C:\Users\brianb\AppData\Local\Android\Sdk
Using sdkmanager: C:\Users\brianb\AppData\Local\Android\Sdk\tools\bin\sdkmanager.bat
Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema
at com.android.repository.api.SchemaModule$SchemaModuleVersion.(SchemaModule.java:156)
at com.android.repository.api.SchemaModule.(SchemaModule.java:75)
at com.android.sdklib.repository.AndroidSdkHandler.(AndroidSdkHandler.java:81)
at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:73)
at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:48)
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.annotation.XmlSchema
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
... 5 more
Update failed. Please check the Android Studio install.
Press any key to continue . . .
Even after I located the sdkmanager.bat script and executed it according to MatPag's answer, my AndroidSetup.bat script was failing.
Eventually I realised the AndroidSetup.bat was trying to call the sdkmanager.bat from the wrong location.
I edited the AndroidSetup.bat file (line 61) as follows to correct the path:
:: set SDKMANAGER=%STUDIO_SDK_PATH%\tools\bin\sdkmanager.bat
set SDKMANAGER=%STUDIO_SDK_PATH%\cmdline-tools\latest\bin\sdkmanager.bat

Error while build with java 16 and gradle 7.0

i tried to build my project with gradle and java 16.
While building the project i get the following error:
Caused by: java.lang.IllegalArgumentException: error: invalid source release: 16
Does anyone has an idea how i can fix it?

Flutter : Android license status unknown

I have seen similar issues but they somehow could not resolve my issue.
I am currently using Windows and Versions Java 8, Java SDK 13.0.1, Android Studio v3.5.2.
1) I First typed flutter doctor and got the following error : Android license status unknown.
2) I then entered flutter doctor --android-licenses and got the following command
A newer version of the Android SDK is required. To update, run:
C:\Users\user\AppData\Local\Android\sdk\tools\bin\sdkmanager --update
3) Running this line I ended up here :
D:\flutter\flutter>C:\Users\user\AppData\Local\Android\sdk\tools\bin\sdkmanager --update
Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema
at com.android.repository.api.SchemaModule$SchemaModuleVersion.<init>(SchemaModule.java:156)
at com.android.repository.api.SchemaModule.<init>(SchemaModule.java:75)
at com.android.sdklib.repository.AndroidSdkHandler.<clinit>(AndroidSdkHandler.java:81)
at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:73)
at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:48)
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.annotation.XmlSchema
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:602)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 5 more
Please let me know the simple steps i could follow as I am confused about this a lot!
To resolve, try running flutter doctor --android-licenses. This should prompt you to accept licenses just type y and enter to accept the licence if error persists check out this issue

Aapt error Android Studio

I'm getting a Aapt error in all of my Android projects.
When searching for an solution I found using android.enableAapt2=false could help, but i'm constantly getting errors like;
Caused by: java.util.NoSuchElementException
at com.google.common.collect.AbstractIndexedListIterator.next(AbstractIndexedListIterator.java:80)
at com.google.common.collect.Iterators.getOnlyElement(Iterators.java:315)
at com.google.common.collect.Iterables.getOnlyElement(Iterables.java:263)
at com.android.builder.internal.aapt.v1.AaptV1.makePackageProcessBuilder(AaptV1.java:202)
at com.android.builder.internal.aapt.AbstractProcessExecutionAapt.makeValidatedPackage(AbstractProcessExecutionAapt.java:67)
at com.android.builder.internal.aapt.AbstractAapt.link(AbstractAapt.java:34)
at com.android.builder.core.AndroidBuilder.processResources(AndroidBuilder.java:807)
... 56 more
I already reinstalled Android Studio, Android SDK and i tried deleting my settings files.
When i'm not using android.enableAapt2=false im getting
Error: java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: AAPT2 error: check logs for details
Caused by: java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: AAPT2 error: check logs for details
at com.google.common.util.concurrent.AbstractFuture.getDoneValue(AbstractFuture.java:503)
at com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:462)
at com.google.common.util.concurrent.AbstractFuture$TrustedFuture.get(AbstractFuture.java:79)
at com.android.builder.internal.aapt.v2.QueueableAapt2.lambda$compile$0(QueueableAapt2.java:136)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
... 1 more
Caused by: com.android.builder.internal.aapt.v2.Aapt2Exception: AAPT2 error: check logs for details
at com.android.builder.png.AaptProcess$NotifierProcessOutput.handleOutput(AaptProcess.java:443)
at com.android.builder.png.AaptProcess$NotifierProcessOutput.err(AaptProcess.java:395)
at com.android.builder.png.AaptProcess$ProcessOutputFacade.err(AaptProcess.java:312)
at com.android.utils.GrabProcessOutput$1.run(GrabProcessOutput.java:104)
I am using Android Studio 3.1.1 build 173.4697961.
edit: I also tried to clean the project, as well as running .gradlew clean, rebuild ect.
edit: I'm using Gradle 4.4 and Android Studio 3.1.1. I cleared the cache and restarted, also I deleted the .gradle/cache folder from my account
I was getting same error, here's steps i followed to resolve it.
-update all files in app.gradle its asking for.
- update all files in build. gradle its asking for.
- invalidate cache and restart Android studio.
Aapt2 is enabled by default when you use android plugin for gradle 3.0.
so open gradle.properties and add android.enableAapt2=false
as shown here https://i.stack.imgur.com/lWyT2.png
I fixed it by reinstalling my PC.
The problem was caused by having ë in my username.
this can happen if you edited String.xml file. reset Strings.xml
I guess by invalidating cache and restarting may fix your problem!

Cordova Build App Issues | JDK | Android Target | avdmanager

I installed latest version of the following tools:
node.js
JDK 8
Android Studio
Cordova
I created an app, however when I try to build for android platform is gives me the following error:
Error: Requirements check failed for JDK 1.8 or greater
If I try cordova requirments,I get the following response:
Requirements check results for android:
Java JDK: installed
Android SDK: installed true
Android target: not installed
avdmanager: Command failed with exit code 1 Error output:
Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema
at com.android.repository.api.SchemaModule$SchemaModuleVersion.<init>(SchemaModule.java:156)
at com.android.repository.api.SchemaModule.<init>(SchemaModule.java:75)
at com.android.sdklib.repository.AndroidSdkHandler.<clinit>(AndroidSdkHandler.java:81)
at com.android.sdklib.tool.AvdManagerCli.run(AvdManagerCli.java:213)
at com.android.sdklib.tool.AvdManagerCli.main(AvdManagerCli.java:200)
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.annotation.XmlSchema
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:582)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:185)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:496)
... 5 more
Gradle: installed /Applications/Android Studio.app/Contents/gradle/gradle-3.2/bin/gradle
Any idea what else I can try update or fix due to these errors ?

Categories

Resources