gomobile command error " No android NDK path is set " - go

I am using Go version 1.7.5 in windows and when i am trying to use gomobile command either to install or bind or build . It displays this error-
"gomobile: no Android NDK path is set. Please run gomobile init with the ndk-bundle installed through the Android SDK manager or with the -ndk flag set."
I have added NDK path to system variable $PATH and even installed NDK manually but still the error persist.
Thanks for your time !!

You need to set the NDK path in gomobile init using the -ndk flag - if you follow these instructions, the path should be ~/Library/Android/sdk/ndk-bundle/:
gomobile init -ndk ~/Library/Android/sdk/ndk-bundle/
Then you can compile the APK:
gomobile build -target=android <PATH>
The path should be relative to $GOPATH/src. For example, if you install the basic example:
go get -d golang.org/x/mobile/example/basic
The build command should be:
gomobile build -target=android golang.org/x/mobile/example/basic

Related

Library missing with GoMobile build

I get the following error while trying to build with Go mobile, fresh install with fresh NDK install. ANDROID_NDK_HOME is set, but it seems to not find a particular library.
Running on Mac.
gomobile: /Users/xxxx/Library/Android/sdk/ndk/23.0.7599858/toolchains/llvm/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-nm /var/folders/zc/4fqpckd56nz59k253rcj66380000gn/T/gomobile-work-456128244/lib/armeabi-v7a/libbasic.so: fork/exec /Users/xxxxx/Library/Android/sdk/ndk/23.0.7599858/toolchains/llvm/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-nm: no such file or directory

no Android NDK found in $ANDROID_HOME/ndk-bundle nor in $ANDROID_NDK_HOME in Windows 10

I'm following the official guide to install gomobile. I have Android Studio installed and via the Android Studio SDK manage installed NDK (side by side) and all the SDK packages. Android Studio has no problem compiling and deploying my normal Android apps to me device.
I ran successfully (by which I mean without any errors):
go env -w GO111MODULE=auto
gomobile init
go get -d golang.org/x/mobile/example/basic
Then I ran:
gomobile build -target=android golang.org/x/mobile/example/basic
And got the error:
gomobile: no Android NDK found in $ANDROID_HOME/ndk-bundle nor in $ANDROID_NDK_HOME
When I run as suggested in the answer to another older thread:
gomobile init -ndk C:\Users\Christian\AppData\Local\Android\Sdk\ndk-bundle
I get:
flag provided but not defined: -ndk
usage: gomobile init [-openal dir]
What do I need to do to fix this?
Solution for linux/mac users
I had the same problem on Linux, and I solved it by making the environment variable like this:
export ANDROID_HOME=$HOME/Android/Sdk
in this path I have the ndk-bundle folder which can also be downloaded from here
after that i could simply run
gomobile bind -x -v .
in my project directory and I get the .aar file that I want.

Ionic: Your JAVA_HOME is invalid

I am facing JAVA_HOME invalid problem.
I have followed these steps:
npm install -g cordova ionic
ionic start myApp tabs
cordova platfomr add android
Installed JDK jdk1.8.0_91
Set JAVA_HOME path as "C:\Program Files\Java\jdk1.8.0_91\bin" in Environment variables
But I am still getting this error: Error: Failed to run "javac -version", make sure that you have a JDK Installed
Actually you have to put "C:\Program Files\Java\jdk1.8.0_91\bin" in PATH variable so it will be accessible from the prompt.

Getting SDK Path error during PyQt5 install

I'm trying to install PyQt5 (PyQt-gpl-5.5.1) following this guide. However, during qmake I'm getting SDK Path error.
python configure.py --qmake /path/to/qmake --verbose
Querying qmake about your Qt installation...
Determining the details of your Qt installation...
/opt/local/libexec/qt5/bin/qmake -o qtdetail.mk qtdetail.pro
Project ERROR: Could not resolve SDK Path for 'macosx10.11'
Error: Failed to determine the detail of your Qt installation. Try again using
the --verbose flag to see more detail about the problem.
xcrun --show-sdk-path and xcodebuild -sdk -version shows that the current sdk version is macosx10.12, while PyQt expects macosx10.11 (based on the system version) and forms .pro file accordingly.
As I get it, somewhere in configure.py SDK version is defined as system version. Can you please help me to find out where?

Ionic trouble: can't build to android

I've got an Ionic 3.4 project and trying to build it to Android for testing purposes.
I installed Android Studio and the Android SDK, aswell Java 8. Then did:
ionic cordova platform add android
Then, when I write...
ionic build android
... I get the following error:
cordova build android ✖ Running command - failed!
[ERROR] Cordova encountered an error.
You may get more insight by running the Cordova command above directly.
[ERROR] An error occurred while running cordova build android (exit
code 1):
ANDROID_HOME=C:\Users\Zerok\AppData\Local\Android\sdk
JAVA_HOME=C:\Program Files\java\jdk1.8.0_121
Error: 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
What's going on? I also installed Gradle 4.0 into the Java folder, and pointed towards it in the GRADLE_HOME environment variable:
Var name: GRADLE_HOME
Value: C:\Program Files\Java\gradle-4.0
Also added the following to the path:
GRADLE_HOME\bin
But it still throws the same error... I don't think it's a problem with plugins, but with the Ionic/Cordova build system. What I don't understand, is why it needs Gradle when it's perfectly working in Android Studio, maybe it's because it's not in C:/, but a different disk? Any ideas?
(Assuming Windows 10)
open Start Menu, type path and hit Enter
System Properties will open. On the bottom click Environment Variables...
In the window that opens, on the bottom section named System Variables, double click Path
Click New and copy paste the path to your gradle installation
Make sure the path environment variable points to the bin folder of gradle like so: export PATH="$PATH:/home/jeffbl/android-studio/gradle/gradle-3.2/bi‌​n".
If that doesn't work try:
$ cordova platform rm android && cordova platform add https://github.com/apache/cordova-android && cordova build
If that doesn't work then use the SDK manager to downgrade to an earlier version of your SDK. It might be that there is no graddle wrapper out yet for the latest.
In any case you will find the answer to your problem in this github issue.
Ok, I already fixed it. And the fix is weird as hell, but well, at least it works.
Solution: uninstall Android Studio and install it in the main drive (C in my case). Everything began to work perfectly after this clean install.

Resources