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!
Related
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?
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
On fresh React-Native project, i would like run default app on Android device, but i've this Java Exception :
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
WARNING: The specified Android SDK Build Tools version (26.0.1) is ignored, as it is below the minimum supported version (27.0.3) for Android Gradle Plugin 3.1.4.
Android SDK Build Tools 27.0.3 will be used.
To suppress this warning, remove "buildToolsVersion '26.0.1'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.
Exception in thread "DisconnectableInputStream source reader" org.gradle.api.UncheckedIOException: java.io.IOException: Resource temporarily unavailable
at org.gradle.internal.UncheckedException.throwAsUncheckedException(UncheckedException.java:57)
at org.gradle.internal.UncheckedException.throwAsUncheckedException(UncheckedException.java:40)
at org.gradle.util.DisconnectableInputStream$1.run(DisconnectableInputStream.java:125)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.io.IOException: Resource temporarily unavailable
at java.io.FileInputStream.readBytes(Native Method)
at java.io.FileInputStream.read(FileInputStream.java:255)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:246)
at java.io.BufferedInputStream.read1(BufferedInputStream.java:286)
at java.io.BufferedInputStream.read(BufferedInputStream.java:345)
at org.gradle.util.DisconnectableInputStream$1.run(DisconnectableInputStream.java:96)
... 1 more
The app has been run on device, but with Error 500 on Metro Bundler.
Anyone can help me about this exception ? I'm on Linux environment.
Thank you community !
You need to create a bundle for your app.
mkdir android/app/src/main/assets
react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res
Then you could run it on your android.
Hope this helps.
By me this error comes up, because i had a bad file in the .idea folder.
found it as i tried to start the deployment server with
npm start
may this helps
Device Info:
windows 10
Android Studio 3.2 or 3.1
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
classpath 'com.android.tools.build:gradle:3.2.0'
Question:
When I create a new Android Project,rebuilding cause this error. I cannot find the solution in google or stackoverflow. The error Log is
"Aapt2Exception: Android resource linking failed Output: error: failed to open APK: Invalid file."
I don't know which APK a building need "open",and cannot find the key point.
I think maybe something wrong with my pc.
Can Anyone help?
log:
com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource linking failed
**Output: error: failed to open APK: Invalid file.**
Command: C:\Users\RABBIT\.gradle\caches\transforms-1\files-1.1\aapt2-3.2.0-4818971-windows.jar\1f6bc70d6f61581570fe3ce3ff0cfffc\aapt2-3.2.0-4818971-windows\aapt2.exe link -I\
D:\RA\PROGRAM\AndroidSDK\platforms\android-28\android.jar\
--manifest\
D:\RA\CODE\RA_CODE\Aapt2Test\app\build\intermediates\merged_manifests\debug\processDebugManifest\merged\AndroidManifest.xml\
-o\
D:\RA\CODE\RA_CODE\Aapt2Test\app\build\intermediates\processed_res\debug\processDebugResources\out\resources-debug.ap_\
-R\
#D:\RA\CODE\RA_CODE\Aapt2Test\app\build\intermediates\incremental\processDebugResources\resources-list-for-resources-debug.ap_.txt\
--auto-add-overlay\
--java\
D:\RA\CODE\RA_CODE\Aapt2Test\app\build\generated\not_namespaced_r_class_sources\debug\processDebugResources\r\
--custom-package\
com.aapt.rabbit.aapttest\
-0\
apk\
--output-text-symbols\
D:\RA\CODE\RA_CODE\Aapt2Test\app\build\intermediates\symbols\debug\R.txt\
--no-version-vectors
Daemon: AAPT2 aapt2-3.2.0-4818971-windows Daemon #0
at com.android.builder.internal.aapt.v2.Aapt2DaemonImpl.doLink(Aapt2DaemonImpl.kt:177)
at com.android.builder.internal.aapt.v2.Aapt2Daemon.link(Aapt2Daemon.kt:103)
at com.android.builder.internal.aapt.v2.Aapt2DaemonManager$LeasedAaptDaemon.link(Aapt2DaemonManager.kt:176)
at com.android.builder.core.AndroidBuilder.processResources(AndroidBuilder.java:823)
at com.android.build.gradle.internal.res.LinkApplicationAndroidResourcesTask.invokeAaptForSplit(LinkApplicationAndroidResourcesTask.java:525)
at com.android.build.gradle.internal.res.LinkApplicationAndroidResourcesTask.doFullTaskAction(LinkApplicationAndroidResourcesTask.java:275)
at com.android.build.gradle.internal.tasks.IncrementalTask.taskAction(IncrementalTask.java:106)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
problem solved
It is because my company's PC has a Encrypting Softwarehttp://www.wowostar.com,it encrypt all files which were created when building.
Need find the process name when building, and add to the Encrypting Software's whitelist.
for my case i deleted the ids.xml file (it was useless in the project)
For my case, add aapt.exe/aapt2.exe to the Encrypting Software whitelist
I downloaded the 3.x version of android studio and got the error below.
Error: java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: AAPT2 error: check logs for details
Then I tried the following method.
android.enableaapt2 = false
At the moment I get an error like this.
The option 'android.enableAapt2' is deprecated and should not be used
anymore. Use 'android.enableAapt2 = true' to remove this warning.
It will be removed at the end of 2018 ..
I tried a method like this.
android.enableaapt2 = true
At the moment I get an error like below. What do I have to do with you?
Error: java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: AAPT2 error: check logs for details