whenever I debug a simple flutter app, it always throws - out of memory error with below logs. I'm using Android Studio 4.0, Flutter 1.17.2, and Java 8.
If I run the Gradle task assembledebug from the command line it builds successfully.
I've set org.gradle.jvmargs=-Xmx2048M -Dkotlin.daemon.jvm.options="-Xmx1024M" -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 in gradle.properties. It drives me crazy , Please help
Logs:
Running Gradle task 'assembleDebug'...
|c:\b\s\w\ir\cache\builder\src\third_party\dart\runtime\vm\zone.cc: 90: error: Out of memor y. version=2.8.3 (stable) (Tue May 26 18:39:38 2020 +0200) on "windows_x64"
Related
I installed Qt 6.3 ,Android Studio 7 (Chipmunk 2021.2.1),java jdk-11.0.15+10 NDK Version: 22.1.7171670).The Android build Platform Sdk 32.
The jdk does not have jre.
A screenshot is attached.
I am using gradle 5.6.4
When I deploy to Android it fails with the following error log (compile output).
"
FAILURE: Build failed with an exception.
Where:
Build file 'C:\Users\o\Documents\build-TrackGate-Android_Qt_6_3_0_Clang_armeabi_v7a-Debug\android-build\build.gradle' line: 17
What went wrong:
A problem occurred evaluating root project 'android-build'.
Failed to apply plugin [id 'com.android.internal.version-check']
Minimum supported Gradle version is 7.0.2. Current version is 5.6.4. If using the gradle wrapper, try editing the distributionUrl in C:\Users\o\Documents\build-TrackGate-Android_Qt_6_3_0_Clang_armeabi_v7a-Debug\android-build\gradle\wrapper\gradle-wrapper.properties to gradle-7.0.2-all.zip
Try:
Run with --stacktrace option to get the stack trace. Run with --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 4m 17s
Building the android package failed!
18:55:35: The process "C:\Qt\6.3.0\mingw_64\bin\androiddeployqt.exe" exited with code 14.
Error while building/deploying project TrackGate (kit: Android Qt 6.3.0 Clang armeabi-v7a)
When executing step "Build Android APK"
18:55:36: Elapsed time: 06:45. "
when i change to gradle7.0.2 i get
"adb.exe: device 'DVKS100I21060300956' not found
...
Installing to device failed!
19:11:44: The process "C:\Qt\6.3.0\mingw_64\bin\androiddeployqt.exe" exited with code 16.
19:11:44: Installing the app failed with an unknown error.
...
19:11:44: The command "C:\Users\o\AppData\Local\Android\Sdk\platform-tools\adb.exe -s DVKS100I21060300956 pull /system/bin/app_process C:/Users/o/Documents/build-TrackGate-Android_Qt_6_3_0_Clang_armeabi_v7a-Debug/app_process" terminated with exit code 1.
19:11:44: Package deploy: Failed to pull "/system/bin/app_process" to "C:/Users/o/Documents/build-TrackGate-Android_Qt_6_3_0_Clang_armeabi_v7a-Debug/app_process
...
19:11:44: The command "C:\Users\o\AppData\Local\Android\Sdk\platform-tools\adb.exe -s DVKS100I21060300956 pull /system/bin/app_process32 C:/Users/o/Documents/build-TrackGate-Android_Qt_6_3_0_Clang_armeabi_v7a-Debug/app_process" terminated with exit code 1.
19:11:44: Package deploy: Failed to pull "/system/bin/app_process32" to "C:/Users/o/Documents/build-TrackGate-Android_Qt_6_3_0_Clang_armeabi_v7a-Debug/app_process".
...
19:11:44: The command "C:\Users\o\AppData\Local\Android\Sdk\platform-tools\adb.exe -s DVKS100I21060300956 pull /system/bin/linker C:/Users/o/Documents/build-TrackGate-Android_Qt_6_3_0_Clang_armeabi_v7a-Debug/linker" terminated with exit code 1.
19:11:44: Package deploy: Failed to pull "/system/bin/linker" to "C:/Users/o/Documents/build-TrackGate-Android_Qt_6_3_0_Clang_armeabi_v7a-Debug/linker".
...
19:11:44: The command "C:\Users\o\AppData\Local\Android\Sdk\platform-tools\adb.exe -s DVKS100I21060300956 pull /system/lib/libc.so C:/Users/o/Documents/build-TrackGate-Android_Qt_6_3_0_Clang_armeabi_v7a-Debug/libc.so" terminated with exit code 1.
...
19:11:44: Package deploy: Failed to pull "/system/lib/libc.so" to "C:/Users/o/Documents/build-TrackGate-Android_Qt_6_3_0_Clang_armeabi_v7a-Debug/libc.so".
Error while building/deploying project TrackGate (kit: Android Qt 6.3.0 Clang armeabi-v7a)
When executing step "Deploy to Android device"
"
Assist in setting-up the environment because an android device is connected via usb.
I finally got it to deploy to device by uninstalling everything related to Qt, Java and and Android Studio. I reinstalled Qt 6.3.1 and used Qt to install Java and Android Studio .I made sure that the Arm64 v8 system image for API 30 is available in Android Studio.
This video link "https://www.youtube.com/watch?v=XrQ_j6VOnzo" helps with Qt 6 installation .
This video link "https://www.youtube.com/watch?v=WafdjRhyDRc" helps with Android Studio installation
so I updated Android studio to 2021.1.1 canary 12 a few days ago and I'm getting this warning when building new projects:
Project BarcodeLookupLib is using the following JDK location when running Gradle:
D:/apps/android-studio/jre // <- location of all my android projects
Using different JDK locations on different processes might cause Gradle to
spawn multiple daemons, for example, by executing Gradle tasks from a terminal
while using Android Studio.
More info...
Select a JDK
Do not show this warning again
when I click select a JDK new window pops up to select Gradle user home:
so I selected the folder of the latest version of Gradle I have C:/Program Files/Android/Android Studio/plugins/Gradle-7.3-rc-3
and still receiving the same error
screenshot of the error and the popup window
I also tried to select from the Gradle JDK: list (screenshot of the lsit), but I have no idea what to select. I don't know why "spawn multiple daemons" is not good but I paid attention to this error while trying to build Android Library on Github and I think this error is causing errors in the "jitpack.io" log. please visit this link to see the log
the full log from "jitpack.io"
Build starting...
Start: Mon Dec 13 10:29:32 UTC 2021 449ea9babe53
Git:
1.0.0-0-g0f1c92a
commit 0f1c92aa93c26b1fd8fe01768bf2f96822b22abb
Author: Fathi Mohamed
Date: Mon Dec 13 13:19:25 2021 +0300
Initial commit
Found Android manifest
Android SDK version: . Build tools:
Found gradle
Gradle build script
Found gradle version: 7.2.
Using gradle wrapper
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8 -Dhttps.protocols=TLSv1.2
Downloading https://services.gradle.org/distributions/gradle-7.2-bin.zip
.10%.20%.30%.40%.50%.60%.70%.80%.90%.100%
------------------------------------------------------------
Gradle 7.2
------------------------------------------------------------
Build time: 2021-08-17 09:59:03 UTC
Revision: a773786b58bb28710e3dc96c4d1a7063628952ad
Kotlin: 1.5.21
Groovy: 3.0.8
Ant: Apache Ant(TM) version 1.10.9 compiled on September 27 2020
JVM: 1.8.0_252 (Private Build 25.252-b09)
OS: Linux 4.14.63-xxxx-std-ipv6-64 amd64
Getting tasks: ./gradlew tasks --all
0m2.925s
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8 -Dhttps.protocols=TLSv1.2
FAILURE: Build failed with an exception.
* Where:
Build file '/home/jitpack/build/app/build.gradle' line: 2
* What went wrong:
An exception occurred applying plugin request [id: 'com.android.application', version: '7.1.0-alpha12']
> Failed to apply plugin 'com.android.internal.application'.
> Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8.
You can try some of the following options:
- changing the IDE settings.
- changing the JAVA_HOME environment variable.
- changing `org.gradle.java.home` in `gradle.properties`.
* 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 21s
Tasks:
WARNING:
Gradle 'install' task not found. Please add the 'maven' or 'android-maven' plugin.
See the documentation and examples: https://jitpack.io/docs/
Adding maven plugin
Found android library build file in product-country-of-origin-lookup
Running: ./gradlew clean -Pgroup=com.github.fathidevs -Pversion=1.0.0 install
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8 -Dhttps.protocols=TLSv1.2
> Configure project :
Gradle version Gradle 7.2
FAILURE: Build failed with an exception.
* Where:
Build file '/home/jitpack/build/app/build.gradle' line: 2
* What went wrong:
An exception occurred applying plugin request [id: 'com.android.application', version: '7.1.0-alpha12']
> Failed to apply plugin 'com.android.internal.application'.
> Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8.
You can try some of the following options:
- changing the IDE settings.
- changing the JAVA_HOME environment variable.
- changing `org.gradle.java.home` in `gradle.properties`.
* 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
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
See https://docs.gradle.org/7.2/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 865ms
Build tool exit code: 0
Looking for artifacts...
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8 -Dhttps.protocols=TLSv1.2
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8 -Dhttps.protocols=TLSv1.2
Looking for pom.xml in build directory and ~/.m2
2021-12-13T10:30:03.794563368Z
Exit code: 0
ERROR: No build artifacts found
I saw this gradle error: "Could not initialize class org.codehaus.groovy.runtime.InvokerHelper". I have tried multiple ways listed online to fix the issue but no luck.
During the debugging, I found weird JVM version.
Installed Java 14 and I have set the path in JAVA_HOME in bash_profile. However, gradle shows JVM 13 version. I am not sure if this cause the error: Could not initialize class org.codehaus.groovy.runtime.InvokerHelper
My java version
java version "14.0.1" 2020-04-14
Java(TM) SE Runtime Environment (build 14.0.1+7)
Java HotSpot(TM) 64-Bit Server VM (build 14.0.1+7, mixed mode, sharing)
Gradle version, but not sure why JVM shows 13
Gradle 6.5
------------------------------------------------------------
Build time: 2020-06-02 20:46:21 UTC
Revision: a27f41e4ae5e8a41ab9b19f8dd6d86d7b384dad4
Kotlin: 1.3.72
Groovy: 2.5.11
Ant: Apache Ant(TM) version 1.10.7 compiled on September 1 2019
JVM: **13.0.2 (Oracle Corporation 13.0.2+8)**
OS: Mac OS X 10.14.6 x86_64
Gradle error
npx react-native run-android
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 960 file(s) to forward-jetify. Using 4 workers...
info JS server already running.
info Launching emulator...
info Successfully launched emulator.
info Installing the app...
FAILURE: Build failed with an exception.
* What went wrong:
Could not initialize class org.codehaus.groovy.runtime.InvokerHelper
* 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
error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Run CLI with --verbose flag for more details.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
FAILURE: Build failed with an exception.
* What went wrong:
Could not initialize class org.codehaus.groovy.runtime.InvokerHelper
* 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
change the version of the gradle
edit the file in YOUR_PROJECT/android/gradle/wrapper/gradle-wrapper.properties and change the version
FROM:
distributionUrl=https://services.gradle.org/distributions/gradle-6.0.1-all.zip
TO:
distributionUrl=https://services.gradle.org/distributions/gradle-6.4.1-all.zip
source: https://github.com/gradle/gradle/issues/10248#issuecomment-633656326
Gradle is very specific about the Java Version. We need to check the compatibility matrix and set the java version to be needed by the gradle version.
https://docs.gradle.org/current/userguide/compatibility.html
The issues related to starting a gradle daemon are mostly because of JAVA. We don't need to upgrade or downgrade gradle version. No change in settings file needed.
You need to change the Gradle version of your project.
It's mentioned in the official docs: https://reactnative.dev/docs/environment-setup
"If you're using the latest version of Java Development Kit, you'll need to change the Gradle version of your project so it can recognize the JDK. You can do that by going to {project root folder}\android\gradle\wrapper\gradle-wrapper.properties and changing the distributionUrl value to upgrade the Gradle version. You can check out here the lastest releases of Gradle."
or see this image
The above mentioned error is very similar to what I faced when starting off with react-native development. This error is caused due to incompatible JAVA JDK and Gradle version in the project. Head to ./android/gradle/wrapper/gradle-properties ..... and change the
required gradle version.
Launching lib\main.dart on Redmi Note 5 Pro in debug mode...
Running Gradle task 'assembleDebug'...
Exception: Gradle task assembleDebug failed with exit code -1
this is the error showing in the run log when im trying to run the demo flutter codes.
I have a problem with my android studio when I build an apk of an opensource project openshop.io, something is on a LegacyDebug task with Gradle,I also tried removing java and android studio and installing a fresh ones java 1.7 and 1.8 both the latest android studio 2.2 with android 15 API and 23 API,24 API , also tried many of researches and solutions here but none of them works in my laptop (I have a windows 10 32 bit 4GB Ram memory), also when I try the same project on my friends laptops the build apk works perfect with no changes on project but in mine not, here is the error in my android studio:
Error:Execution failed for task ':app:transformClassesWithDexForLegacyDebug'.
com.android.build.api.transform.TransformException: java.lang.RuntimeException: java.lang.RuntimeException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: java.lang.UnsupportedOperationException
this error showes up on this task which failed to run:
Information:Gradle tasks [installLegacyDebug]