How to find the path to NDK? - java

I installed NDK using Android Studio (SDK Manager). Where is the default directory of NDK for Mac? How do I find the path to it?

My understanding is that now the NDK bundle is being offered via the SDK Manager within Android Studio, it will install into the Android SDK directory as per the other components (platforms, build tools, support repositories, etc.) in the SDK Manager.
You can check the location of the SDK directory itself via Android Studio -> Preferences... -> Appearance & Behavior -> System Settings -> Android SDK -> Android SDK Location field near the top of the panel.
I've customised mine (it's editable) so I'm afraid I don't know what the default is, but if you check the contents of the directory listed in that field then the NDK should be installed into a subdirectory called ndk-bundle.

You can find it on $ANDROID_SDK_PATH/ndk-bundle.
ANDROID_SDK_PATH is your SDK path which I suppose you have set it already.

Finding your SDK/NDK library path needs information about how you installed them. However, there are two possible solutions to find them
Using Android Studio: the possible way to find is using Android Studio. Open your Android Studio Preference (or "File->Settings") > Appearance & Behavior > System Settings > Android SDK. You can find the path to your SDK and NDK, which is in the same directory.
Using Terminal: Open Terminal and put the command as below. Hopefully, if ANDROID_HOME environment has been set.
echo $ANDROID_HOME

Related

How to update to SDK 24.0.2

SDK Platforms
SDK Tools
[![enter image description here][3]][3]
You can even update to the latest by changing the build tool in build.gradle file, but as you said you are pretty new and firstly just want to run this project by installing the build tool version 24.0.2
Please click on Show Package Detail of your second screenshot then you will start seeing all the other build tool version you can install and you will find your 24.0.2 as well like I started seeing that after selecting the Show Package Detail.
Go to Tools > SDK Manager.
Make sure Android SDK Location matches your local.properties file sdk.dir value. (Fix it in the file if required)
In the SDK Platforms tab, check an install Android 7.
In the SDK Tools tab check and install 24.0.2.
make sure you have internet connection and build the project again.
On the main menu click Build > Make Project

How to fix "JAVA_HOME environment references a directory" in unity3d

I have a problem showed on this screenshot:
Android Resolver
JAVA_HOME environment references a directory (C:\Program
Files\Java\jdk1.8.0_212) that does not contain java which is required
to process Android libraries.
The problem has appeared when I imported GoogleMobileAds package to insert AdMob ads to my project. I tried to create 2 local variables "JAVA_HOME" and "PATH" in environment variables using this guide https://null-code.ru/solution/157-reshenie-exception-jar-not-found-windows.html , but it doesn't help me.
It is a Unity bug. To fix:
Edit->Preferences->External Tools
Uncheck Android SDK Tools Installed with Unity (recommended)
Press Browse -> It might update the filepath
Recheck Android SDK Tools Installed with Unity (recommended)
Then:
Assets->Play Services Resolver->Android Resolver->Resolve
This has been tested and works with Unity 2019, Unity 2020, and Unity 2021.
try
Assets-> Play Services Resolver-> Android Resolver-> Delete Resolved Libraries
check is your Java set true or not:
go to cmd and type JAVA -version
if this appeared means your JDK is set if not check this link: https://confluence.atlassian.com/doc/setting-the-java_home-variable-in-windows-8895.html
after these, if you have the problem again update your JDK
from https://www.oracle.com/technetwork/java/javase/downloads/index.html
i was using admob plugin in my project and this is how i resolved the issue after trying all given solutions.
reimport the admob plugin / plugins you are using in your project. (i just reimport the latest version of admob plugin and issue resolved)
For me it was similar to this answer https://stackoverflow.com/a/57361245/2149955 but just a bit different so sharing a separate answer for when you haven't installed the tools through unity hub.
In Unity:
Edit->Preferences->External Tools
See error messages "You are missing the recommended <TOOL>. Install the recommended version using Unity Hub"
In Unity Hub:
Installs -> My Unity Version -> ... -> Add Modules, Twirl open Android Build Support -> Check Android SDK & NDK Tools (I also checked OpenJDK)
Press Next -> Accept Terms
Wait for install to finish
After that finishes, back in Unity:
If you look in external tools again, the error messages will be gone
Assets->Play Services Resolver->Android Resolver->Resolve
Update to Unity 2019.4.10f
fixed it
When I wanted to make an app for Android, I got this and many more as errors. Nothing worked, including the solutions here. I tried both Unity versions 2020.3.5f1 and 2019.4.22f1, it didn't work.
I figured out that the problem was due to "Android Built Support" not being fully installed. I did the following and the problem was gone:
Unity Hub (my version 2.4.3) -> from the left menu, go Installs
Click the 3 dots in the upper right corner of the Unity version you want (I used 2019.4.22f1) -> Add Modules
From Platforms, find "Android Built Support"
Its check box was checked because I installed it before, but if you don't have it, first install it
Display its submodules with the arrow to its left; "Android SDK & NDK Tools" and "OpenJDK"
Check their check boxes, next and install
Restart Unity
When you open the project, it resolves
It gave me another warning after the resolve, so I made sure that the problem was gone by doing "Assets->External Dependency Maneger->Android Resolver->Force Resolve" in the project again.
I faced this error when I wanted to build for Android. The reason I have faced this is that I had 2 Unity versions (2019.4.9f1 and 2020.3.3f1), and my JAVA_HOME was configured to use the java folder inside 2019.4.9f1. I then uninstalled and removed 2019.4.9f1, and after that, I got this error when trying to build in 2020.3.3f1.
I changed my JAVA_HOME variable permanently, following the link below:
How to set JAVA_HOME in Mac permanently?
Restarted my Macbook.
Went to Unity -> Preferences -> External tools, unchecked NDK, JDK, etc., clicked the Browse button that appeared, and selected the folder under 2020.3.3f1 manually for JDK.
(In the end, no folder should change when you uncheck and check again)
Simple fix. I got this message about Missing the JDK. If you have one that is similar or pointing to the wrong JDK you can try this fix.
Here is the Error I was getting:
I solved this by:
In Unity goto "Edit->Preferences->External Tools"
Unchecked the box "JDK Installed with Unity (recommended)", and noticed that the Path was pointing to an Old version of Unity I had uninstalled.
Changed the Path to the current version of Unity I am usings, OpenJDK directory.
Re-checked the box "JDK Installed with Unity (recommended)"
Then was able to build my game, and build to my android phone just fine.
Note: If your having problems with the SDK or NDK you could try this solution, by unchecking, and re-checking their respective boxes.
This Worked For me:
If u had rectified
JAVA_HOME,
JDK SDK files &
every possible way and solution does not show up try
preference -> in android untick the JDK installed..,
if you see a change in directory then just re tick,
copy path of JDK and uncheck,
finally paste the path close(x) preference TRY BUILD & RUN
Next time you open Unity Editor then try to check & uncheck JDK we have to see the same directory both ways
there is no sdk if you install unity editor without hub.
it seems unity want to use the versions they want. so it's very poor support for previous historty version.
there is a workaround. you can install a version offically recommanded.
and then copy the sdk, ndk, openjdk folder from the offical version folder to the folder you are using. for windows, these folder is like this:
from:
C:\Program Files\Unity\Hub\Editor\2021.3.21f1c1\Editor\Data\PlaybackEngines\AndroidPlayer\OpenJDK
to:
C:\Program Files\Unity\Hub\Editor[your_version]\Editor\Data\PlaybackEngines\AndroidPlayer\OpenJDK

Run "Android update project --path ." return invalided number of parameters

I am using Windows 7 and I am new to Android development. I had no problem build android app with Ecliose, but I felt it would be very nice if I can build the android application with command lines. So,I have done some Google, and I found that I can use Ant to build my android app, so I have installed Ant and Added Android to my path.
When I run "Android update project --path ." command, I have got the following message, I am not sure if it is an error message or not.
The message was "invalid number of parameters the system cannon find the path specified. Updated local.properties"
Please give me some ideas on this. Thank you.
Added Android to my path
Please make sure you have added the ...\sdk\tools to your path.Also you need to add the apache-ant\bin to your path.
So your environmental variables should look something like this
Variable Name PATH
Variable Values C:\Program Files (x86)\apache-ant-1.9.4\bin;C:\Users\HP\Eclipse Android Developer\adt-bundle-windows-x86_64-20131030\sdk\tools
Before updating a project also make sure that you have the latest version of Android SDK Build Tools.You can update your Android SDK Build Tools using the Android SDK manager.

The project was not built

I am unable to resolve the error below.
"The project was not built since its build path is incomplete. Cannot find the class file for android.content.Context. Fix the build path then try building this project"
I imported the existing project into eclipse and the above error message was shown. I checked the other solution in this site but no solution worked.
Go to Windows --> preferences --> Android then check out for version of your workspace and Android SDK you are using. Add external jar files for the correct version of android platform
For instance you are using 2.2 then minimum sdk is 8, then you have to add android 8 platform jar file.
Also check your SDK path just in case where you have located it may be in case you using Windows 7 and you may have put your sdk folder in program file(x 86) for 32 bit.
Go to build path -> configure build bath.Click on android in left menu bar.choose any android vendor present over there.Click apply and ok.So that , all android related stuff get build.

Android Build Target cant be selected in eclipse

I followed these tutorials to set up a Hello World Android app. But when I create a new java project I can't select a build target. It just says no targets available in the target selection box. I have confirmed that I am not having the UI issue described here (http://blog.rowancrane.com/2009/12/27/eclipse-new-android-project-cant-select-build-type-target), I actually have a message in the box saying there are no targets instead of an empty box. I also am using 1920x1080 res.
I'm guessing that eclipse is just not aware of my Android Targets? I installed them in the android SDK manager and see them listed under installed packages in the Android SDK manager (1.1, 1.6, ..., 2.2)
http://fyi.oreilly.com/2009/02/setting-up-your-android-develo.html
http://developer.android.com/resources/tutorials/hello-world.html
Any suggestions on how I can create the project and get started?
Thanks in advance
In Eclipse, do this:
Window -> Preferences -> (In the field "SDK Location", add your path to your Android folder, e.g. "C:\android-sdk-windows" and then click "Apply" -> OK.
Now you should be able to select a target.
For MAC users,
In Eclipse, do this:
Eclipse -> Preferences -> Android -> (In the field "SDK Location", add your path to your Android folder, e.g. "/Users/user/Projects/Android/android-sdk-mac_x86" and then click "Apply" -> OK.
Now you should be able to select a target.
Please make sure that at least one version of Android SDK is installed. To check this, go to window > Android SDK Manager.
Don't create a Java Project, instead create an Android Project. In the setup steps you can define a build target. Hope this helps.
just upgrade android sdk ools to rev. 22.6.2 n problem will be solved,at least my problem is solved

Categories