Unable to run flutter project. Asking for specific NDK version - android

Launching lib\main.dart on M2004J19C in debug mode...
What went wrong:
A problem occurred configuring project ':flutter_libserialport'.
NDK at C:\Users\M.K. Malik\AppData\Local\Android\sdk\ndk\21.1.6352462 did not have a source.properties file
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 2m 47s
Running Gradle task 'assembleDebug'... 175.8s
Exception: Gradle task assembleDebug failed with exit code 1
How to fix or install that specific NDK version?

Firstly check your NDK version using android studio
Go to Tools->SDK Manager (or Files->Settings->Appearance & Behavior->System Settings->Android SDK ). Then select the SDK Tools tab, and check the Show Package Details checkbox. You will see your NDK version.
You can also easily install or upgrade new NDK version using android studio -> SDK manager -> SDK tools . Select the show package detail checkbox. You will be able to see all the NDK versions available.
The error displayed by you shows that some file in missing from the NDK version you have my suggestion is you should reinstall that version

You need to download NDK from SDK Manager in SDK Tools Tab (select show package details)
In Some Cases, CMake also needed which is also available in SDK Tools tab
And in app/build.gradle file you need to specify the version
like this
ndkVersion "25.1.8937393"

Related

Ionic build time error "No installed build tools found. Install the Android build tools version 30.0.3 or higher"

I'm stack on one error in on build time with Cordova.
I have already installed android build tools but ionic through error "No installed build tools found. Install the Android build tools version 30.0.3 or higher". I do not understand why this error show. Below mentioned error, please check and help me.
ANDROID_HOME=C:\Users\prade\AppData\Local\Android\Sdk (DEPRECATED)
Using Android SDK: C:\Users\prade\AppData\Local\Android\Sdk\build-tools\32.0.0
Subproject Path: CordovaLib
Subproject Path: app
FAILURE: Build failed with an exception.
Where:
Script 'C:\ionic\demoApp\platforms\android\CordovaLib\cordova.gradle' line: 69
What went wrong:
A problem occurred evaluating script.
No installed build tools found. Install the Android build tools version 30.0.3 or higher.
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.1.1/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 1s
Command failed with exit code 1: C:\ionic\demoApp\platforms\android\gradlew :app:bundleRelease -b C:\ionic\demoApp\platforms\android\build.gradle
[ERROR] An error occurred while running subprocess cordova.
cordova.cmd build android --release exited with exit code 1.
Re-running this command with the --verbose flag may provide more information.
The error produced by Cordova is misleading (there is an open issue here).
Cordova by default is looking for build tools version >= 30.0.3 but still within version 30. The purpose for this behaviour is so Cordova doesn't automatically pick up a build tools version that it is likely not compatible with.
Using <preference name="android-buildToolsVersion" value="32.0.0" /> should allow you to override this behaviour and Cordova will use the desired build tools version as requested.
However there are known incompatiblities with Build tools version 31, and I doubt build tools 32 will work either. I'd highly suggest installing build tools 30.0.3 as that's the version that is tested against the current version of cordova.
Navigate to your android build tools directory
C:\foo\sdk\build-tools\32.0.0
and rename d8.bat to dx.bat
Now do the same for d8.jar in the /lib folder.
Credits go to 'user16475264' (https://stackoverflow.com/a/68430992/3365033)

Flutter debugging fails

I want to run a flutter application that I wrote on Visual Studio Code on the device. However, when I do this, I always get the following error. Normally this wouldn't happen, it's just starting to happen. I'm not entirely sure what I should do.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:compileDebugKotlin'.
> Kotlin could not find the required JDK tools in the Java installation '/usr/lib/jvm/oracle-java8-jre-amd64' used by Gradle. Make sure Gradle is running on a JDK, not JRE.
* 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
BUİLD FAILED in 45s
Exception: Gradle task assembleDebug failed with exit code 1
OS : Ubuntu
Mobile Device : Samsung J500F
Android Version : 6.0.1
You need to have installed a JDK. Depending on which version of Ubuntu you should just be able to do sudo apt install openjdk-8-jre-headless
That said, I would target a higher Java version, if I were you, maybe 11?
Either way, if you look at the path your JRE is in, it's '/usr/lib/jvm/oracle-java8-jre-amd64'
You don't want to be using the regular JRE to build/run your application. You want to build and run with openjdk. That's why your error message says,
"Make sure Gradle is running on a JDK, not JRE."
The message Execution failed for task ':app:compileDebugKotlin' and the Gradle issue indicate that your problem is not about Flutter but about Android, and more precisely about the lack of JDK (which allows to execute Java and Kotlin code).
To solve this problem, it is necessary to review the configuration of your project.
I advise you if possible to use Android Studio, an IDE recommended by Android developers and that will make things much easier with Android and Flutter.
This article from the official Android documentation and this one from JetBrains should help you solve your problem.
You can install Android Studio from snap store or zip

Could not determine the dependencies of task ':app:compileDebugJavaWithJavac' - Flutter

I just started flutter online course . I followed every step the instructor did , but when I run the project , I got this error :
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
> Failed to install the following Android SDK packages as some licences have not been accepted.
build-tools;28.0.3 Android SDK Build-Tools 28.0.3
platforms;android-29 Android SDK Platform 29
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\ASUS\AppData\Local\Android\sdk
* 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.
I didn't get any of a thing they said in there , and I m new to stack overflow so please don't mind if my question is bad. Any help is appreciated , thanks!
This is the emulator I used :
The picture of the emulator
You need to open the SDK Manager window and accept the license agreements there.

Can't open Ionic Framework compiled project in Android Studio

I'm currently working on Ionic Framework based Android App. I've complete setup of Android Studio & Android SDK.
Android Studio 2.2.2
Android SDK Tools 25.2.2
Android SDK Platfrom Tools 25.0.0
Android SDK Build Tools 25.0.0
Android SDK Platform 24 rev. 2
Android SDK Platform 23 rev. 3
Android Support Repository 39
Google Repository 37
The ionic build android & ionic emulate android commands works fine. but, When I'm attempting to open build project in Android Studio, it throws the following error.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':CordovaLib:processDebugAndroidTestResources'.
> A problem occurred starting process 'command 'E:\Android\android-sdk\build-tools\25.0.0\aapt.exe''
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
I can't figure out what's going wrong. Any suggestions or help are welcomed.
Thanks in advance
check E:\Android\android-sdk\build-tools\25.0.0.for aapt.exesome times it occur due to missed options or ircorrect directory

How to install android constraint layout tools outside of Android Studio by using the command line?

I'm manually installing an Android-Gradle build server which means that I'm not using Android Studio SDK but instead using the android update sdk command to install the required tools.
I was able to install most of the packages which are required for the build to finish successfully but there are some tools which I'm unable to find:
com.android.support.constraint:constraint-layout:1.0.0-alpha(1-4)
com.android.support.constraint:constraint-layout-solver:1.0.0-alpha(1-4)
Following #CommonsWare comment, here's the output of the build (which shows that the tools are being looked for at the repositories automatically but not found:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':Company'.
> Could not resolve all dependencies for configuration ':Company:_productionDebugCompile'.
> Could not find com.android.support.constraint:constraint-layout:1.0.0-alpha4.
Searched in the following locations:
https://jcenter.bintray.com/com/android/support/constraint/constraint-layout/1.0.0-alpha4/constraint-layout-1.0.0-alpha4.pom
https://jcenter.bintray.com/com/android/support/constraint/constraint-layout/1.0.0-alpha4/constraint-layout-1.0.0-alpha4.jar
http://dl.bintray.com/optimizely/optimizely/com/android/support/constraint/constraint-layout/1.0.0-alpha4/constraint-layout-1.0.0-alpha4.pom
http://dl.bintray.com/optimizely/optimizely/com/android/support/constraint/constraint-layout/1.0.0-alpha4/constraint-layout-1.0.0-alpha4.jar
file:/Users/itai/work_repos/Company-Android_fork/.gradle/android-sdk-linux/extras/android/m2repository/com/android/support/constraint/constraint-layout/1.0.0-alpha4/constraint-layout-1.0.0-alpha4.pom
file:/Users/itai/work_repos/Company-Android_fork/.gradle/android-sdk-linux/extras/android/m2repository/com/android/support/constraint/constraint-layout/1.0.0-alpha4/constraint-layout-1.0.0-alpha4.jar
file:/Users/itai/work_repos/Company-Android_fork/.gradle/android-sdk-linux/extras/google/m2repository/com/android/support/constraint/constraint-layout/1.0.0-alpha4/constraint-layout-1.0.0-alpha4.pom
file:/Users/itai/work_repos/Company-Android_fork/.gradle/android-sdk-linux/extras/google/m2repository/com/android/support/constraint/constraint-layout/1.0.0-alpha4/constraint-layout-1.0.0-alpha4.jar
Required by:
Company-Android_fork:Company:unspecified
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 15.163 secs
Any idea how they can be installed manually (not through Android Studio)?
Thanks in advance,
Now you can install it through command line:
your_sdk_location/tools/bin/sdkmanager "extras;m2repository;com;android;support;constraint;constraint-layout;1.0.2"
It is not possible without Android Studio 2.2 Beta yet, but if you have it somewhere, then you just need to copy the m2repository from your sdk/extras to your project sdk/extras folder.
So if you have your project built in an Android Studio:
check the project's sdk location (File/Project Structure : SDK location).
go to your_sdk_location/extras folder and copy m2repository
paste the folder to your existing project's sdk/extras folder.
rebuild your project.

Categories

Resources