Cannot add additional platforms/build tools in Android Studio - android

I installed Android Studio Arctic Fox 2020.3.1 on Ubuntu via the Ubuntu Software Center having previously installed the Java and android SDK's using apt from a terminal, following the official installation instructions and I had no reported issues while installing or after. When I ran Android Studio, its seems to have detected the Android SDK location which is installed at:
/usr/lib/android-sdk
but when I tried to add additional platform and tools for android nougat in:
Tools->Android SDK->Android SDK Location
The Android SDK location is:
/usr/lib/android-sdk
Which is correct, but when I click Edit and the SDK Components Setup dialog is loaded, the Android SDK location is again displayed and is also correct, however there's a warning message underneath which states:
<!> An existing Android SDK was detected. The setup wizard will only download missing or outdated SDK components.
When that appears to be merely stating the obvious and doesn't need to be said, so why the warning?. I just ignored it anyway and tried to add some additional plaform support. Prior to that, to test android studio was working after install, I rebuilt an existing hello-world project and the target platform from previous builds was 27.0.1 and as a result of rebuiding that existing project Android Studio appears to have created a hard link from 27.0.1 which it installed to the 'debian' folder, so when I list that location in a terminal I get:
$ls -al /usr/lib/android-sdk/build-tools/
lrwxrwxrwx 1 root root 6 Aug 29 2019 27.0.1 -> debian
drwxr-xr-x 3 root root 4096 Aug 11 00:22 debian
As you can see '27.0.1' is a hard link to the debian folder and by checking the properties of the link I can confirm it was created by Android Studio on 11th August which is the date it was installed:
27.0.1 Properties
Name: 27.0.1
Type: Link to folder (inode/ directory)
Parent folder: /usr/lib/android-sdk/build-tools
Modified Wed 11 Aug 2021 12:22:55 BST
When I attempt to install any additional platforms and tools, Android Studio now complains and cannot continue, it tells me to check the log and when I examined the Idea.log it says:
'build-tools;debian' in inconsistent location '/usr/lib/android-sdk/build-tools/27.0.1' (Expected '/usr/lib/android-sdk/build-tools/debian')
when the expected location exists and there appears to be no such issue, since the Android SDK is exactly where the installer put it and exactly where it should be, I dont know why it thinks there is a problem, where there doesn't appear to be one. However I dont know why Android Studio created the hard link for platform 27.0.1 -> debian when it added that platform to build hello world?

I worked out the solution myself. The solution is:
(Note: you need to ensure your PC is connected to the internet, so Android Studio can download the Android SDK)
Uninstall the Android SDK.
In my case, I installed the Android SDK via apt in a terminal, so I uninstalled using the following commands:
sudo apt-get remove android-sdk
and then
sudo apt-get --purge remove android-sdk
Launch Android Studio and it will automatically start the Android Studio Setup Wizard and issue the pop-message:
Title: Missing Components
Message: No Android SDK found
Follow the wizard to install the SDK.
This time the SDK is installed to your home directory and Android Studio has no issues with the SDK.
To test it all works, I installed the additional build-tools and target platforms for my test app and built and ran it on an AVD and everything works fine.

Related

Error Initializing ADB: Android Debug Bridge not found [duplicate]

After updating Android Studio to 2.0 l am getting this error unable to obtain debug bridge and Android Device Monitor does not open. Anyone faced this error before?
I just open sdk manager and installed all android sdk tools and done.
Check whether you need to install "Android Sdk Platform Tools" in the Android SDK Manager.
Somehow, after installing Android Studio from the bundle (for Linux) I lacked the "platform-tools" directory in "Android/Sdk", where the adb executable resides. Installing the platform tools helped. It was easier to find in the standalone sdk manager.
This is because you deleted the adb.exe (it might be your antivirus who deleted it),that resided in the platform tools in the android sdk folder.
What you need to do is to delete the current platform-tools in the sdk manager program and re install it all over again.
I installed the right sdk version that matched my virtual device android version
I am also running the same problem when update android studio from 1.4 to 1.5 stable version. When I run adb command from terminal then i found following error :
bash: ./adb: cannot execute binary file: Exec format error
After R&d I found that this error occurs due to unsupported architecture. In my case:
I am using ubuntu14.04 LTS 32-bit. I observed that after updation, lib folder under platform-tools converted to lib64. I think above error occurs due to 32-bit architecture because after updation 32-bit support removed.
For permanent solution upgrade you system to 64-bit architecture.
Quick solution is to replace the updated platform-tools folder with old one that containing the lib folder instead of lib64.
I think 32-bit architecture support for android development stopped by google for future releases. But I am not sure.
I am phase these error when updating Android-SDK Plateform-Tools 23.1 in Android SDK Manager
i am worked on ubuntu 14.04 [32bit] that is not supporting with Plateform-Tools 23.1 it is only supporting in 64bit Operating System architecture that's why downgrade my Plateform-tools 23.0
it works perfect...!!!
Go to: Android Studio Settings > Appearance & Behavior > System Settings > Android SDK:
If path for SDK are text in red, change to your SDK folder and click ***APPLY***
Open the standalone SDK manager and install the platform tools package.

Cordova App in VS2015 does not build after sdkmanager update

Since I got some errors in my android emulator I manually updated my Android SDK using the command line sdkmanager. It seems the "old" SDK Manager does not support updates anymore. I do not have Android Studio installed (I did not need it since VS2015 installed the platform tools, too). After the update I have to use command line tools for avdmanager and sdkmanager. The "old" AVD Manager and SDK Manager do not work anymore.
However after this update Visual Studio 2015 could not compile my Codova app. I always got the error:
Android SDK not found. Make sure that it is installed. If it is not at the default location, set the ANDROID_HOME environment variable.
Before the app was building correctly.
I did set up the ANDROID_HOME variable to the SDK path (same path as in ADT_HOME). I also tried the suggestion by Abdul Rauf Mujahid to manually edit the regedit.
Both actions did not help.
The ADT_HOME variable is still a valid path.
It seems that others had similar problems Shandu
It seems that android was removed in the last update of the tools. In order to resolve this issue I had to downgrade my Andoid tools and platform-tools.
I downloaded the older revisions of sdk tools Revision 25.3.0 (March 2017) as well as platform tools Revision 25.0.3 and copied them into the relevant folders.
Now I can again compile my Cordova app

Appcelerator Studio will not install Android SDKs

I am using Appcelerator Studio on Mac OS X
Appcelerator Studio, build: 4.4.0.201511241829
Build: jenkins-appcelerator-rcp-master-339 (origin/master)
Date: 24 November 2015, 18:30:16
Titanium SDK version 5.1.2.G
I have been trying to install the Android SDK's without success. I am using the Install from the software under Preferences -> Platforms -> Android
If I browse to the directory with the SDKs I get the error message:
[Android SDK Home] No Android SD...nder the specified SDK location
All the Android SDKs have been loaded by Android Studio so I know they are there.
If I try to install the SDKS through Studio it goes through the motions, downloads and unpacks the files etc and then gives me a completed screen but no sdks is actually saved.
I have tried uninstalling and reinstalling Studio without success
any help is appreciated
Just give path of your android-sdk main directory only. If you are doing correctly then check in that folder having all required folders or not. I attached screenshot for what folders should be there.
If any of folder missing in mentioned image, it means, your SDK not properly installed. And you need to install it again. you can download SDK from here: http://developer.android.com/sdk/index.html#Other
Follow the instruction given in above link and again set path as you were doing before. And install all required SDK using install SDK given in Preferences -> Platforms -> Android.

Error:Unable to obtain debug bridge in android studio

After updating Android Studio to 2.0 l am getting this error unable to obtain debug bridge and Android Device Monitor does not open. Anyone faced this error before?
I just open sdk manager and installed all android sdk tools and done.
Check whether you need to install "Android Sdk Platform Tools" in the Android SDK Manager.
Somehow, after installing Android Studio from the bundle (for Linux) I lacked the "platform-tools" directory in "Android/Sdk", where the adb executable resides. Installing the platform tools helped. It was easier to find in the standalone sdk manager.
This is because you deleted the adb.exe (it might be your antivirus who deleted it),that resided in the platform tools in the android sdk folder.
What you need to do is to delete the current platform-tools in the sdk manager program and re install it all over again.
I installed the right sdk version that matched my virtual device android version
I am also running the same problem when update android studio from 1.4 to 1.5 stable version. When I run adb command from terminal then i found following error :
bash: ./adb: cannot execute binary file: Exec format error
After R&d I found that this error occurs due to unsupported architecture. In my case:
I am using ubuntu14.04 LTS 32-bit. I observed that after updation, lib folder under platform-tools converted to lib64. I think above error occurs due to 32-bit architecture because after updation 32-bit support removed.
For permanent solution upgrade you system to 64-bit architecture.
Quick solution is to replace the updated platform-tools folder with old one that containing the lib folder instead of lib64.
I think 32-bit architecture support for android development stopped by google for future releases. But I am not sure.
I am phase these error when updating Android-SDK Plateform-Tools 23.1 in Android SDK Manager
i am worked on ubuntu 14.04 [32bit] that is not supporting with Plateform-Tools 23.1 it is only supporting in 64bit Operating System architecture that's why downgrade my Plateform-tools 23.0
it works perfect...!!!
Go to: Android Studio Settings > Appearance & Behavior > System Settings > Android SDK:
If path for SDK are text in red, change to your SDK folder and click ***APPLY***
Open the standalone SDK manager and install the platform tools package.

Cannot find a compatible Android SDK for compilation when running `tns platform add android`

I am following an official NativeScript tutorial and having a problem configuring my OS X environment for android development.
When running tns platform add android I receive the following error:
Cannot find a compatible Android SDK for compilation. To be able to build for Android, install Android SDK 21 or later.
The tns doctor command also returns warnings on android-sdk issues:
Cannot find a compatible Android SDK for compilation. To be able to
build for Android, install Android SDK 21 or later. Run $ android to
manage your Android SDK versions. You need to have the Android SDK
Build-tools installed on your system. You have to install version 22.
Run "android" from your command-line to install required Android Build
Tools. You need to have the latest Android Support Repository
installed on your system. Run $ android to manage the Android
Support Repository.
My android-sdk installation looks like this:
My .bash_profile also includes the followings:
export ANDROID_HOME="/usr/local/Cellar/android-sdk/24.3.4/"
export PATH="$PATH:~/npm-global/bin:/usr/local/Cellar/android-sdk/24.3.4/tools:/usr/local/Cellar/android-sdk/24.3.4/platform-tools"
Should I go further and try setting system-wide environment variables - not just for the .bash_profile? Also, it is possible that I missed something from the setup process...
Any tip on how I could debug this situation (commands, config files etc.) would be great, thank you!
Alright, so you need to make sure of following:
Make sure you have API 22 installed.
Make sure you you have Android SDK Build Tools 22.x.x installed. (Yes,
specifically 22.x.x)
Make sure you have Android support repository installed. (You can
find it under Extras section in Android SDK Manager)
Once you have performed steps mentioned above, run tns doctor again and you should see No issues were detected message.
This is because of sudo. The root user has no ANDROID_HOME set.
For Windows User:
Run 'android update sdk' from command line
Select Android 5.1.1(API22)
Select Tools folder
Select Extras and click on Install.
ps:- adding this answer, so that if any one land on this page can see it.
Check the ANDROID_HOME is ok
Install the API 22 + ion the Extras > Android Support Repository
Run the following
tns platform remove android
tns platform add android#next
Run
tns run android
then it should be OK
I solve this problem installing Android Support Repository from Extras.
updating SDK in AndroidStudio >> Preferenceswould help
on my windows 10 machine I had to open file explorer right click on this pc and go to properties on the left hand side I had to go to advanced settings. At the bottom I click environment variables then on the android_home variable I clicked edit then pointed it to this path on my machine where the sdk was installed
C:\Program Files (x86)\Android\android-sdk
This answer is on a Linux, not OSX, platform. However, since this is the SO that appears most often for the listed error, I'll share a recent fix that worked for me.
If you have done all of the above and are still getting the error, try this solution.
I am using NativeScript 8.0.2.
You will know that ANDROID_HOME and Java are configured correctly if you can run the command $ANDROID_HOME/tools/bin/sdkmanager --list. If that fails, then first check that your Java is compatible (I had to add OpenJDK 8 and change my PATH with export JAVA_HOME="/usr/lib64/jvm/java-1.8.0/")
In Android Studio, add a previous build tool version. Go to your SDK Manager > SDK Tools, tick the bottom box "Show package details", and add a previous version. In my case, 31.0.0 was the latest, and I added 30.0.3. Now run ns doctor android again and everything should pass.
Seems 31.0.0 is not yet properly recognised by Native Script.
I always got the error "✖ Cannot find a compatible Android SDK for compilation. To be able to build for Android, install Android SDK 28 or later. "
I actually had to go to the android studio settings and install the exact SDK 28 before this error went away.
Android Settings Pic
This is an updated answer, I also had the same issue:
Like all the previous pictures above, I had to install the SDK platforms, using the SDK Manager. From the main screen of Android Studio, click More Actions and choose SDK Manager. Before that I had to add the platform-tools to my PATH in Windows
%LOCALAPPDATA%\Android\Sdk\platform-tools
That fixed my issue and the docs for setup are here.

Categories

Resources