I have downloaded android-ndk-r10e & I have also setted path in environment variable as well as NDK path for eclipse. I was able to build and run HelloJni sample app from eclipse, but when I use console to build it says
'ndk' is not recognized as an internal or external command,operable
program or batch file.
I have googled this and have also installed Cygwin even though it's not mentioned in offical google installation instructions(https://developer.android.com/ndk/guides/setup.html) but to no vain.
I have set my path but when I do echo %path% it dosen't show up. How can I use NDK from command lines.
The command you're probably looking for is ndk-build, not ndk.
Related
I'm struggling to understand how to open applications from shell.
When I use Atom, I can just run
$ atom .
command to open it in the current directory, but I don't know how to do it with Android Studio.
I don't know if it has something to do with aliases, environment variables or something else, but I'd like to know how this stuff works. I'd also appreciate a short comparison of the same problem on Linux.
On my winslow-7 machine there is an icon on the desktop named "Android studio".
I checked the properties of this icon, and in the destination field I've found:
"C:\Program Files\Android\Android Studio\bin\studio64.exe"
If I type that in a command prompt, Android studio opens normally.
A similar thing works in Linux too.
Basically, to run a program, you have to know where its executable resides; then you can ask the shell to run that executable. A few directories are searched automatically by the system and, if the executable resides in one of those directories, there is no need to indicate the full path - the name of the file suffices. The list of directories is an environment variable, PATH, for both windows and Linux.
This is a short and incomplete answer, though; your question asks a comparison and/or something more, but it is not clear and there would be a lot to say.
If you use the studio64 . command, your current folder will open in android studio.
This works if you've added the path of the bin directory of the android studio installation folder to environment variables. In my case, it is C:\Program Files\Android\Android Studio\bin.
This works the same as atom . or code .(VSCode)
The problem is, that it returns a bunch of warnings and stuff in the terminal before launching android studio. Also, if you close the terminal, the studio crashes.
It works but it's not purrfect.
For Windows:
Make a shortcut for your application and place in C:\WINDOWS\System32
you will be able to call it by the name of the shortcut.
For Linux:
echo $PATH
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.
When I run the ionic capacitor run android command, to launch my application in Android Studio, I get the error saying:
Unable to launch Android Studio." You must configure "linuxAndroidStudioPath" in your capacitor.config.json to point to the location of studio.sh, using JavaScript-escaped paths:
example:
{
"linuxAndroidStudioPath": "/usr/local/android-studio/bin/studio.sh"
}
but I configured the path my capacitor.config.json but the error persists.
Here's my capacitor.config.json file
First, run whereis android-studio in your terminal. This command will return the path of your android studio.
Mine is /snap/android-studio/current/android-studio/bin/studio.sh. I installed android-studio from the ubuntu software store. Maybe you installed it through a different source and in a different location.
Then add "linuxAndroidStudioPath": "/snap/android-studio/current/android-studio/bin/studio.sh" in capacitor.config.json which is located in the root of your project.
Replace /snap/android-studio/current/android-studio/bin/studio.sh by your path. which is returned to you by whereis android-studio
"linuxAndroidStudioPath": "/snap/android-studio/current/android-studio/bin/studio.sh" is the path.
Add sudo when running the project sudo npx cap open android
in my case, android studio location was "/opt/android-studio/bin/studio.sh"
{
...
"linuxAndroidStudioPath": "/opt/android-studio/bin/studio.sh"
}
I use JetBrains Toolbox and macOS
to open the capacitor project with Android Studio with npx cap open android I had to export the Android Studio path as follow:
export CAPACITOR_ANDROID_STUDIO_PATH="/Users/myuser/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/201.7199119/Android Studio.app"
Set environment variable--
Step1- Run: nano ~/.bashrc in terminal.
Step2- Add export CAPACITOR_ANDROID_STUDIO_PATH="path of android-studio/bin/studio.sh" in .bashrc file.
Step3- Run npx cap open android in terminal.
I have the same issue and I didn't manage to find out why it can't verify the path for android studio.
In order to use npx cap open android i had to open Android Studio before running the command.
Open your terminal and run gedit .bashrc.
Set the environment variable:
export CAPACITOR_ANDROID_STUDIO_PATH="path of android-studio/bin/studio.sh"
Save your file with Ctrl+s.
This will read your capacitor directly by running
Ionic cap open android
All of the answers here are on point, however I would like to add something small to note.
Its worth noting that Android Studio has different installation locations depending on the distribution you are using and also some installations are command-line based others are offline installations.
Some well known places are:
/usr/local
/usr/share
/opt
Lastly whereas the commands to search for android-studio may work in some instances where the default installation path was not changed. However the command
whereis android-studio
will not return anything in a case where the directory name is not the default i.e
/opt/android-studio-2021.2.1/android-studio/bin/studio.sh"
or
/usr/local/android-studio-2021.2.1/bin/studio.sh"
Here's how I solved this: In Ionic 6x, there's no capacitor.config.json. You'd have to set an environment variable of CAPACITOR_ANDROID_STUDIO_PATH globally. Do this by typing
export CAPACITOR_ANDROID_STUDIO_PATH=/path/to/android-studio/studio.sh
Worth noting that my Android Studio is found at /opt/android-studio/bin and not under /snap/...
Everything looks correct so the likely answer is that you have got the path wrong somehow.
Could you recheck it?
Also, are you running the latest versions of everything?
I have some issues in building ics-openvpn project. When I deploy the app on the device and try to import a .ovpn file, I get cannot find minivpn. I think this error is related to an error during the app building.
I've downloaded android NDK and set the path in Eclipse, downloaded cygwin and launched ./build-native.sh, but it returns me the error
./build-native.sh: line 1: ndk-build: command not found
I've tried to modify the path in the .sh with the path of ndk-build, but I get another error:
NON-CYGWIN COMPATIBLE MAKE PROGRAM.....
Anyone knows what steps I have to follow to properly build the project?
You should not try to build it with the cygwin. There is also a build-native.bat in the project which allows the project to be build with windows. Make sure that you have installed the ndk and ndk-build is in your PATH.
Run build-native.bat
make sure you must have NDK 8b and set the environment variable for the ndk file
I am trying to install Rhodes for Android application development. I installed rhodes gem (version 3.2), Android SDK latest release and Android NDK (latest). I run "rhodes-setup" and gave the installation path of Java, Android SDK and NDK. When i try to run "rake run:abdroid" for a sample rhodes applocation, it shows as
"WARNING!!! Path to Android NDK contain spaces! It will not work because of the G
oogle toolchain restrictions. Move it to another location and reconfigure rhodes."
I moved to another location and tried a another version of NDK ( revision 6 and 6b). But still having error. Could please point out what i am doing wrong?
Thank u.
Make sure there are no spaces in the path, like the error message suggests.
Bad NDK Path
C:\Program Files (x86)\android-ndk-r4\
Good NDK Path
C:\source\sdks\android-ndk-r4\
Update the path to the NDK in the Rhodes build configuration files. Try running "rhodes-setup" again and pointing it to your new NDK path.
Just move your NDK folder to your root folder. I have it like this:
C:\android-ndk-r5b
Remember to configure rhodes setup after you have made this change and before running your program. You do this by running:
$ rhodes-setup
on the command prompt while in your app folder.