Category: Using NDK with Android studio on Windows 7 64-bit
MyProject has MyNdkProject native code under MyNDKProject/src/main/jni/ path.
.so file gets generated using ndk-build.cmd from Android Studio terminal.
However, when executing the complete project it exits with following error from gradle console
'"D:\MyProjectPath\find-win-host.cmd"' is not recognized as an internal or external command,
operable program or batch file.
Error:Execution failed for task ':MyNdkProject:ndkBuild'.
> Process 'command 'ndk-build.cmd'' finished with non-zero exit value 1
How to resolve this problem with Android studio?
problem is resolved with Android Studio Beta (0.8.4) and gradle version (1.12)
java version is 7v67, older java version was 7v25.
It seems that problem was due to older java version. Please agree.
Related
Recently installed flutter sdk, Android studio 4.1 and Flutter and Dart plugins for both VSCode and Android studio. Running flutter doctor gives me the following
[√] Flutter (Channel stable, 1.22.3, on Microsoft Windows [Version 10.0.18363.1198], locale en-IN)
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
[!] Android Studio (version 4.1.0)
X Flutter plugin not installed; this adds Flutter specific functionality.
X Dart plugin not installed; this adds Dart specific functionality.
[!] Connected device
! No devices available
! Doctor found issues in 2 categories.
A similar question has been asked Flutter Doctor, Flutter & Dart plugin not installed which says its a bug in the 4.1 release, but the github repo says the bug has been fixed and to ignore the warning.
I've tried:
1)Disabling and Re-enabling the plugins
2)Reinstalling the plugins
3)Reinstalling both VSCode and Android Studio
4)Checking if the plugins are installed in the right place
5)Executing it on another emulator and device
When i execute
import 'package:flutter/material.dart'; //for materials
void main() {
runApp(MaterialApp(
home: Container(
color: Colors.purple,
),
));
}
This is the output i get in the debug console:
'attrib' is not recognized as an internal or external command,
operable program or batch file.
FAILURE: Build failed with an exception.
* Where:
Script 'C:\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 677
* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'cmd'' finished with non-zero exit value 1
* 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 28s
Exception: Gradle task assembleDebug failed with exit code 1
Exited (sigterm)
Solution:
Browse to the environment variable setting and update PATH variable to contain address for your System32 folder.
i.e C:\Windows\System32
After adding the variable, restart your computer.
It will fix the error.
Reason: This problem occurred because the system didn't found the 'attrib' file.
I had been developing a flutter mobile app for a couple of months and all was good. I just came back to the project and a few things (flutter, dart, android studio etc) upgraded. Now I can't compile my app. I created a new flutter app (the default example) and that won't compile either.
The error I'm getting is :
FAILURE: Build failed with an exception.
* What went wrong:
Could not open settings remapped class cache for bq3hllkgb26p0nrblf5gh8d37 (C:\Users\Paul\.gradle\caches\5.6.2\scripts-remapped\settings_cbd968glg60byp9f5t6vvdlee\bq3hllkgb26p0nrblf5gh8d37\settings8410a2d21ed2f87c8a0398566330ee52).
> Could not open settings generic class cache for settings file 'D:\Apps\Flutter\Examples\flutter_app\android\settings.gradle' (C:\Users\Paul\.gradle\caches\5.6.2\scripts\bq3hllkgb26p0nrblf5gh8d37\settings\settings8410a2d21ed2f87c8a0398566330ee52).
> BUG! exception in phase 'semantic analysis' in source unit '_BuildScript_' Unsupported class file major version 57
I am running:
Flutter 1.20.2
Dart 2.9.1
Android Studio 4.1
Java 1.8.0_261
JVM 13.0.2
Gradle 6.7
Windows 10
Try running
flutter stable
flutter clean
flutter downgrade
cd <Your App Folder>
and then
flutter run
in command line
I ended up completely removing Flutter from my system and then re-installed it. This fixed everything.
I made a neko project for Windows using FlashDevelop. I want to see if I can port it for android without remaking code or too much of it. In the past I was able to port to hmtl5 without having to remake code. Of course making an APK is different and requires getting some packages installed, I know that. The question is can I build android or I have to start a new project (like AS3) and go on in its own way?
I setup the
Path to Android SDK [C:\Programs\Android Development\platform-tools]: (contains adb, other files and the build-tools folder)
Path to Android NDK [C:\Programs\Android Development\android-ndk-r20]:
Path to Java JDK [C:\Programs\Android Development\jdk1.8.0_221]:
A simple project that displays an image. Errors I get when building 'android'
‘arm-linux-androideabi-g++’ is not recognized as an internal or external command,
operable program or batch file.
Error: Could not create PCH
Build halted with errors.
Or
in NativeCFFI.hx error: function body required
#:cffi private static function lime_jni_create_method(className:String, method:String, signature:String, isStatic:Bool, quiet:Bool):Dynamic;
‘arm-linux-androideabi-g++’ is not recognized as an internal or external command, operable program or batch file. Error: Could not create PCH Build halted with errors.
That error comes from an Android NDK that is too recent. Current HXCPP releases only support versions up to r15c, so I suggest you downgrade to that version.
Alternatively, you could try installing HXCPP from GitHub, as support for newer NDKs was recently merged.
I have error after minor update Android Studio. Ubuntu 18.04, Android Studio 3.1.2
Caused by: org.gradle.process.internal.ExecException: A problem occurred starting process 'command '/home/private/Android/Sdk/ndk-bundle/toolchains/mips64el-linux-android-4.9/prebuilt/linux-x86_64/bin/mips64el-linux-android-strip''
Caused by: net.rubygrapefruit.platform.NativeException: Could not start '/home/private/Android/Sdk/ndk-bundle/toolchains/mips64el-linux-android-4.9/prebuilt/linux-x86_64/bin/mips64el-linux-android-strip'
Caused by: java.io.IOException: Cannot run program "/home/private/Android/Sdk/ndk-bundle/toolchains/mips64el-linux-android-4.9/prebuilt/linux-x86_64/bin/mips64el-linux-android-strip" (in directory "/home/private/StudioProjects/yamatrack-cart-app-android/viewer"): error=2, No such file or directory
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
2 solution if you use an older gradle version
don't use the latest ndk 17 because they have removed the mips build scripts
copy the mips folder from ndk 16 under toolchain into ndk 17.
Second solution worked for me even with configured nbi filters.
I was getting this error when trying to build an older release of my code which was using an old version of the Android Gradle Plugin.
I found that upgrading to the latest Android Gradle plugin (3.1.2) fixed this. Although it is a bit worrying that I can't just checkout an older version of my code and build it with the plugin version from that release.
Although the build now appears to succeed with the newer Gradle plugin, I am getting this slightly worrying warning:
Unable to strip library 'MyApp/build/intermediates/transforms/mergeJniLibs/develop/debug/0/lib/mips/libsqlite3x.so' due to missing strip tool for ABI 'MIPS'. Packaging it as is.
I have this in my build.gradle as I depend on some native libs:
ndk {
abiFilters "armeabi-v7a", "x86"
}
In build.gradle, I have commandLine 'jni/ndk-build.cmd' inside one of my tasks.
The contents of ndk-build.cmd is very simple:
[path containing ndk]\android-ndk-r8e\ndk-build.cmd APP_ABI="all" NDK_DEBUG=0
This works fine if I run "gradle assemble" in the command prompt. Android Studio however fails in the build process:
Information: 1 error
Information: 0 warnings
Error: Gradle: Execution failed for task ':mytask'
> A problem occurred starting process 'command 'jni/ndk-build.cmd''
Is commandLine not supported in Android Studio? If it matters, I've also tried running Android Studio as administrator (Windows).
I found the solution.
If Making in Android Studio on Windows, the command in build.gradle must be commandLine 'cmd', '/c', 'jni\\be-arm7.cmd'
The 'cmd' argument isn't necessary if the script is being run from the command prompt, which is why I saw no error doing so.