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.
Related
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.
I have installed cordova with npm install -g cordova and NPM path is C:\Users{yourName}\AppData\Roaming\npm but I want to install everything (specially cordova) on some other drive rather than 'C'. Not sure how it is possible.
I did this by installing cordova without '-g' as it does global installation.
To install cordova to desired location just change the directory to that location in command prompt and run below command
npm install cordova
and to check installation
cordova --version.
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/bin".
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.
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
I will try my best to explain what I did and where I am right now. I am using window7
What I did for installation.
Installed jdk and updated the environment path variable and created new one JAVA_HOME
Downloaded Gradle and updated the environment path pointing to bin directory of gradle
Installed android sdk with all the specified version, sdk tool, and platform tools.
Created ANDROID_HOME variable.
Remove and Reinstalled Nativescript
Ran tns doctor command and result can be found here
Launched the app via tns run android --emulator and tried on device as well error received was "Unfortunately mysir has stopped" and log can be found here.
Now Can anyone please tell me what I am missing?
Check out if <your app>\platforms\android\src\main\assets\internal\prepareExtend.js file exists. This file is supposed to be created when you execute tns platform add android command. If the file does not exist then it may be better to create a new project.
well the whole problem was I was not running command npm install tns-core-modules --save after creating new project.