Android Studio - tools.jar error while trying to build the project - java

I am trying to run the mlkit demo application from github on my local setup in Android studio , but when i am trying to build i am getting below error
"Cannot determine path to 'tools.jar' library for Android API 26 Platform (C:/Users//AppData/Local/Android/Sdk)"
I have tried installing jdk 8 which has tools.jar and put the java home path to the same jdk path but still error persists
Also when i try for android app bundle i get another issue as gradle plugin should be 3.2 or higher although my gradle plugin is higher than 3.2
Any help is appreciated

Related

Android Studio - 'com.android.internal.application' Java 11 - fix gradle projects not visibile in Android studio

I have the issue
Error: Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8. -& Failed to apply plugin 'com.android.internal.application'
Error: Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8. -& Failed to apply plugin 'com.android.internal.application'
The solution requires to download JDK 11.0, then change gradle projects - the option is not available in Android studio. Do I need to upgrade android studion or change the setups?
No, you do not need to do anything that complex. First, download OpenJDK 11 from here. Extract the contents of the zip in a folder. Then, find the gradle.properties file in your android project (Create one if it's not there). Then. add this property to it:
org.gradle.java.home=path/to/jdk11
Note: Do not point towards the bin folder, just point towards the home JDK 11 directory.

Cannot determine path to 'tools.jar' library for Android API 21 Platform (/home/user/Android/Sdk)

I am a newbie to Android development.
I installed the Android studio at Ubuntu 20.04.
I have installed Java (I know that the installation was ok since I used it also at Tizen development)
I try to build a project, but an error occurs:
Cannot determine path to 'tools.jar' library for Android API 21 Platform (/home/user/Android/Sdk)
I manually copied the tools.jar file into the sdk directory but nothing changed.
Any ideas?

Cannot start "jarsigner.exe" process in Windows

I am generating a release Android app bundle in Android Studio, but I am getting the following error:
java.lang.RuntimeException: Cannot start "jarsigner.exe" process, please add it to the PATH
I have installed Java JDK and JRE and I am using Windows. Please see the error details in the screenshot:
Upgrade the gradle project and android-gradle plugin.

Android SDK license issue prevents build of LibGDX project in IntelliJ

After reinstalling Windows 10, I am desperately trying to get my LibGDX project to run in IntelliJ again. It will not build because of an Android SDK license issue.
I reinstalled Android Studio and the Android SDK 27, which I had been using in my project before, but I got the following error message:
A problem occurred configuring project ':android'.
Failed to install the following Android SDK packages as some licences have not been accepted.
platform-tools Android SDK Platform-Tools
patcher;v4 SDK Patch Applier v4
platforms;android-27 Android SDK Platform 27
build-tools;27.0.3 Android SDK Build-Tools 27.0.3
emulator Android Emulator
tools Android SDK Tools
I found the following thread with lots of suggested fixes:
"Failed to install the following Android SDK packages as some licences have not been accepted" error
So I learned that I have to run
%ANDROID_HOME%/tools/bin/sdkmanager --licenses
It did not work at first because the file /users/MYUSERNAME/.android/repositories.cfg was missing. I created an empty file at that path, ran sdkmanager again and accepted all licenses. However, I still get the same error when building my LibGDX project in IntelliJ.
Here is what I have tried to resolve this issue:
Ran sdkmanager --licenses with administrator priviledges
Ran sdkmanager --update instead of --licenses
Installed the Android command line tools and used that sdkmanager batch file instead
Made sure that the %ANDROID_HOME%\licenses folder exists and contains license files
Made sure that there is not another Android SDK installed on my machine that I am not aware of - both ANDROID_HOME and ANDROID_SDK_ROOT (I read that the former is outdated) environment variables point to the same folder that is also configured as Android SDK location in the Android Studio SDK Manager and as an Android SDK home path in my IntelliJ project settings
Selected the JRE that comes with Android Studio as the standard Java runtime environment on my machine (by setting JAVA_HOME to C:\Program Files\Android\Android Studio\jre)
Uninstalled the API 30 SDK that was automatically installed with Android Studio, so I would only have API 27 left
Tried using the API 30 SDK instead of API 27 by configuring it in the android\build.gradle file of my LibGDX project
Uninstalled Android Studio, removed the SDK folder and reinstalled everything
Added yes | sdkmanager --licenses to my gradlew.bat
None of these seemed to help. When I run sdkmanager --licenses again, the response is
All SDK package licenses accepted.
but IntelliJ keeps saying the opposite.
I am out of ideas how to resolve this. Any help would be highly appreciated.
The issue was most likely due to an incompatibility of the outdated Gradle version with some other dependency, possibly the Android SDK. I resolved it by migrating my project to the newest LibGDX version (1.9.11).
My game would not run with the Gradle wrapper configured in gradle/wrapper/gradle-wrapper.properties (version 5.4.1) because I got another error message ("Could not open cp_init remapped class cache"), so I switched to the latest Gradle version, which is locally installed (6.5.1): Settings -> Build, Execution, Deployment -> Build Tools -> Gradle -> Use Gradle from: Specified location
I also downloaded the Android API from 30 to 29, as that is the version recommended for use with LibGDX 1.9.11. However, I did not have to use the command line tool to accept the licenses anymore.

How to add Android SDK in IntelliJ? Error that Java SDK is missing, although it exists

I have Java SDK Installed
But I still get an error that Java SDK is missing when adding Android SDK
I add root folder in ~/Library/Android/sdk as SDK path

Categories