I have a problem to run flutter app from VS Code,
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
java.lang.IllegalAccessError: class org.gradle.internal.compiler.java.ClassNameCollector (in unnamed module #0x3d67da21) cannot access class com.sun.tools.javac.code.Symbol$TypeSymbol (in module jdk.compiler) because module jdk.compiler does not export com.sun.tools.javac.code to unnamed module #0x3d67da21
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
BUILD FAILED in 3s
Exception: Gradle task assembleDebug failed with exit code 1
What flutter doctor said :
[✓] Flutter (Channel stable, 2.2.3, on macOS 11.4 20F71 darwin-arm, locale
en-RS)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[✓] Xcode - develop for iOS and macOS
[✓] Chrome - develop for the web
[!] Android Studio
✗ **Unable to find bundled Java version.**
[✓] Connected device (2 available)
I resolved it on my side by creating a symbolic link:
cd /Applications/Android\ Studio.app/Contents/jre;
ln -s ../jre jdk;
ln -s "/Library/Internet Plug-Ins/JavaAppletPlugin.plugin" jdk
Not the most elegant solution, but worked. the problem is that the system finds two java versions, and either the android licenses are not accepted, or the bundled version is not found. So instead I removed the link and added an other one. and that finally did the trick
source: https://github.com/flutter/flutter/issues/27136#issuecomment-888915746
I think you should specify the path to your Java SDK in Android Studio, you can set it by doing the following:
Generally speaking, it is set in the "Project Structure" dialog.
Go to File > Project Structure > SDK Location. The third field is "JDK
Location" where you can set it. This will set it for the current
project.
How to set Java SDK path in AndroidStudio?
Related
I am trying to run a react native app on a m1 mac, generated with react-native-starter-kit.enter link description here. When I run the app with npx react-native run-android, I get the following error
error Failed to install the app. Please accept all necessary Android
SDK licenses using Android SDK Manager:
"$ANDROID_HOME/tools/bin/sdkmanager --licenses".
I tried to run the sdkmanager as following
export JAVA_HOME=/Applications/Android\ Studio.app/Contents/jre/Contents/Home
cd ~/Library/Android/sdk/tools/bin/
./sdkmanager --licenses
I get an Error
Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema
Then I tried this JAVA_HOME
export JAVA_HOME=$(/usr/libexec/java_home -v 1.8)
cd ~/Library/Android/sdk/tools/bin/
./sdkmanager --licenses
And it works, All SDK package licenses accepted.======] 100% Computing updates...
But when I run npx react-native run-android after that, I still have a licence error
Failed to install the app. Please accept all necessary Android SDK licenses using Android SDK Manager
I have the feeling I am accepting the licenses in the wrong JDK. Any idea?
You should make sure that you set up you development envoirement the correct way.
The Official Guide explains it step by step.
For you paragraph 2 (Install the Android SDK) should be helpful
I'm trying to upgrade my Ionic Android APP with new functionalities but get an error
Run $ ionic cordova build android --prod
cordova build android --release
Generating initial manifest for Ionic Deploy...
Ionic Deploy initial manifest successfully generated.
Checking Java JDK and Android SDK versions
ANDROID_SDK_ROOT=/albertosanmartinmartinez/Library/Android/sdk/tools/bin/platform-tools/emulator/build-tools/29.0.0-rc2/zipalign (recommended setting)
ANDROID_HOME=/Users/albertosanmartinmartinez/Library/Android/sdk (DEPRECATED)
Could not find an installed version of Gradle either in Android Studio,
or on your system to install the gradle wrapper. Please include gradle
in your path, or install Android Studio
[ERROR] An error occurred while running subprocess cordova.
cordova build android --release exited with exit code 1.
Run $ brew info gradle
gradle: stable 6.8.1
Open-source build automation tool based on the Groovy and Kotlin DSL
https://www.gradle.org/
Not installed
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/gradle.rb
License: Apache-2.0
==> Dependencies
Required: openjdk ✘
==> Analytics
install: 65,592 (30 days), 151,847 (90 days), 558,625 (365 days)
install-on-request: 64,753 (30 days), 150,185 (90 days), 546,096 (365 days)
build-error: 0 (30 days)
Reinstall $ brew install gradle and export it export PATH=$PATH:/usr/local/Cellar/gradle/gradle-7.0.2/bin
And we rerun $ ionic cordova build android --prodhrow new error
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:stripDebugDebugSymbols'.
No version of NDK matched the requested version 21.0.6113669. Versions available locally: 20.0.5594570
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
BUILD FAILED in 7s
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.5/userguide/command_line_interface.html#sec:command_line_warnings
38 actionable tasks: 2 executed, 36 up-to-date
Command failed with exit code 1: /Users/.../platforms/android/gradlew cdvBuildDebug -b /Users/.../platforms/android/build.gradle
Anybody could help me please ?
Thanks in advance.
> cordova requirements android
You have been opted out of telemetry. To change this, run: cordova telemetry on.
Requirements check results for android:
Java JDK: installed 1.8.0
Android SDK: installed true
Android target: installed android-28,android-27
Gradle: installed /usr/local/Cellar/gradle/5.4.1/bin/gradle
> cordova build android
You have been opted out of telemetry. To change this, run: cordova telemetry on.
Checking Java JDK and Android SDK versions
ANDROID_SDK_ROOT=undefined (recommended setting)
ANDROID_HOME=/Users/juliano/Library/Android/sdk (DEPRECATED)
FAILURE: Build failed with an exception.
* What went wrong:
Could not create service of type ScriptPluginFactory using BuildScopeServices.createScriptPluginFactory().
> Could not create service of type FileHasher using BuildSessionScopeServices.createFileSnapshotter().
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 1m 2s
/usr/local/Cellar/gradle/5.4.1/bin/gradle: Command failed with exit code 1
[ERROR] An error occurred while running subprocess cordova.
cordova build android exited with exit code 1.
Re-running this command with the --verbose flag may provide more information.
It seems windows defence for controlled folder access was causing the issues. once I turned it off I was able to build for android as usual.
This is my environment: OS: Linux Mint 19 Tara Cinnamon 64bit (based on Ubuntu 18.04)
$ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel beta, v0.10.2, on Linux, locale en_US.UTF-8)
[✓] Android toolchain - develop for Android devices (Android SDK 28.0.3)
[✓] Android Studio (version 3.2)
[✓] VS Code (version 1.28.2)
[✓] Connected device (1 available)
• No issues found!
This error appears in debug console when I click Debug > Start Debugging in Visual Studio Code.
Launching lib/main.dart on Android SDK built for x86 in debug mode...
FAILURE: Build failed with an exception.
* Where:
Script '/home/ilhamwahabigx/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 602
* What went wrong:
Could not determine the dependencies of task ':app:flutterBuildDebug'.
> java.net.URISyntaxException: Illegal character in opaque part at index 2: E:\\flutter\\.pub-cache\\hosted\\pub.dartlang.org\\collection-1.14.11\\lib\\collection.dart
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 1s
Gradle task assembleDebug failed with exit code 1
Exited (sigterm)
Any help would be appreciated?
You need to run flutter clean first. Then run your app with this command flutter run. This works for me, I hope to work for you.
i'm using MacOs, what worked for me was upgrading flutter flutter upgrade --force and restart android studio, if not worked you can try changing flutter channel to master and re change it to stable
I am getting the following error when trying to install Android Studio 3.1 Preview 2 on Windows:
Error: CreateProcess error=216, This version of %1 is not compatible
with the version of Windows you're running. Check your computer's
system information and then contact the software publisher.
I have tried to install the following - but still didn't help:
Install jdk1.8.
I also tried the following in Android Studio:
File->Project Structure->SDK Location (select your directory where the JDK is located, by default Studio uses embedded JDK) -> Click OK
But for some reason this produces error=216.