My React-Native application suddenly stopped working when I installed and tried to import react-native-vector-icons module (even though I do not make any connection with the problem).
It seems that my AVD failed miserably. I had problems with ADB seemingly not working anymore but I guess I solved them. Afterwards, I started getting errors from SDK licenses, being informed that I did not accept them. I used sdkmanager.bat, and accepted all of them. On running npm run android I was receiving the same error. Seemingly, even though the licenses were accepted, the folder containing them was not where it was searched for (Android\Sdk\platform-tools\licenses). So I copied it there.
Next time, the licenses were accepted, but I get this error that says the SDKs cannot be downloaded because the folders already exist (I do not understand why I have to download the SDK AGAIN, anyway). I go on and delete all conflicting folders just to run the command again, the CLI starts downloading (I guess) and making the folders I have deleted just so that immediately after I am again informed that the folders exist.
My best guess (and I'm probably wrong) is that while resolving ADB / license conflicts, somehow I messed up the Path Variables. I changed them 100 times anyway, one step away from backtracking the shit out of them.
I deleted all Android folders, Android Studio, SDK's, started everything all over again just to get back to this point. I've wasted 8 hours. Please, give me a hand.
Running on Marshmallow 23.0.1 ofc.
Thank you in advance!
npm run android
ReactNNN#0.1.0 android D:\Work\reactn-naturist react-native
run-android
Scanning folders for symlinks in D:\Work\reactn-naturist\node_modules
(20ms) JS server already running. Building and installing the app on
the device (cd android && gradlew.bat installDebug)... Observed
package id 'platform-tools' in inconsistent location
'C:\Users\alexandru.andronache\AppData\Local\Android\Sdk\platform-tools'
(Expected
'C:\Users\alexandru.andronache\AppData\Local\Android\Sdk\platform-tools\platform-tools')
Observed package id 'platform-tools' in inconsistent location
'C:\Users\alexandru.andronache\AppData\Local\Android\Sdk\platform-tools'
(Expected
'C:\Users\alexandru.andronache\AppData\Local\Android\Sdk\platform-tools\platform-tools')
Observed package id 'platform-tools' in inconsistent location
'C:\Users\alexandru.andronache\AppData\Local\Android\Sdk\platform-tools'
(Expected
'C:\Users\alexandru.andronache\AppData\Local\Android\Sdk\platform-tools\platform-tools')
File C:\Users\alexandru.andronache\.android\repositories.cfg could not
be loaded. Checking the license for package Android SDK Build-Tools
23.0.1 in C:\Users\alexandru.andronache\AppData\Local\Android\Sdk\platform-tools\licenses
License for package Android SDK Build-Tools 23.0.1 accepted. Preparing
"Install Android SDK Build-Tools 23.0.1". Warning: Trying to install
into
C:\Users\alexandru.andronache\AppData\Local\Android\sdk\platform-tools\build-tools\23.0.1\
but package "Android SDK Platform-Tools" already exists at
C:\Users\alexandru.andronache\AppData\Local\Android\sdk\platform-tools\.
It must be deleted or moved away before installing into a child
directory. Checking the license for package Android SDK Platform 23 in
C:\Users\alexandru.andronache\AppData\Local\Android\Sdk\platform-tools\licenses
License for package Android SDK Platform 23 accepted. Preparing
"Install Android SDK Platform 23". Warning: Trying to install into
C:\Users\alexandru.andronache\AppData\Local\Android\sdk\platform-tools\platforms\android-23\
but package "Android SDK Platform-Tools" already exists at
C:\Users\alexandru.andronache\AppData\Local\Android\sdk\platform-tools\.
It must be deleted or moved away before installing into a child
directory.
FAILURE: Build failed with an exception.
* What went wrong: A problem occurred configuring project ':app'.
Failed to install the following SDK components: [Android SDK Platform 23, Android SDK Build-Tools 23.0.1] Please install the
missing components using the SDK manager in Android Studio.
* Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 4.505 secs Could not install the app on the device, read
the error above for details. Make sure you have an Android emulator
running or a device connected and have set up your Android development
environment:
https://facebook.github.io/react-native/docs/android-setup.html
My PATH variables:
P.S. I read all other similar posts and couldn't manage anything. Just getting from error to error.
in your Android Studio go to the SDK manager and then click the Show Package Details.
Try to install these sdk packages:
These worked for me.
If still not work add to the path variable the /platform-tools (same path as /tools)
Related
I've been trying to integrate Android Emulator in my Jenkins workflow on my Windows PC using this plugin. I've been facing this error.
Started by user admin
Running as SYSTEM
[EnvInject] - Loading node environment variables.
Building in workspace C:\Users\user\.jenkins\workspace\Testing if android emulator works
[android] Outdated SDK Tools found. Upgrading from '26.1.1' to 'build 6609375'
[android] Android SDK installation failed
[android] hudson.plugins.android_emulator.SdkInstallationException: Failed to download Android SDK
at hudson.plugins.android_emulator.SdkInstaller.doInstall(SdkInstaller.java:91)
at hudson.plugins.android_emulator.SdkInstaller.install(SdkInstaller.java:72)
at hudson.plugins.android_emulator.AndroidEmulator.setUp(AndroidEmulator.java:278)
at hudson.model.Build$BuildExecution.doRun(Build.java:157)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:514)
at hudson.model.Run.execute(Run.java:1907)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:97)
at hudson.model.Executor.run(Executor.java:429)
Caused by: java.io.IOException: Failed to donwload SDK archive
at hudson.plugins.android_emulator.SdkInstaller.installBasicSdk(SdkInstaller.java:189)
at hudson.plugins.android_emulator.SdkInstaller.doInstall(SdkInstaller.java:89)
... 8 more
Finished: NOT_BUILT
I have taken the following steps after seeing people's discussions on SO and other websites (but haven't been able to resolve the issue):
Updated to latest android skd, and sdk command line tools. Also, updated possibly everything else that I could from Android Studio.
Added windows/system32 in path in env variables
Ran cmd as admin to run jenkins (realised later that it's a bad idea as scripts can do anything)
Went to http://localhost:8080/configure > set Android SDK root variable.
Went to http://localhost:8080/configure > tick Environment variables > set ANDROID_HOME & JAVA_HOME variables.
Went to http://localhost:8080/configureTools/ > set jdk installation.
Note: I've verified that all environment variables are correct.
Here's some of my thought process:
The error message says that it's trying to update tools from v 26.1.1 to a newer version. But I don't even have sdk tools of this version in my Android SDK!
This may hint to a dual installation of Android sdk but there only one. And after that, I don't know what's wrong...
I'm stuck on this for several days now & any help or suggestion will be greatly appreciated :)
In the ENV, you specified paths to internal Android SDK tools? For example, you add to PATH /emulator and /platform-tools folders? This folders contains in the Android SDK root.
So while installing flutter and Android Studio. I did encounter several problems. First is the "Exception: Gradle task assembleDebug failed with exit code -1" when i run the program. this thing always appears in my runs no matter which folder/emulator I do. So I tried to go and check several videos. including uploaded by BD Technic(youtube) how to fix this kinds of problem. I also went to SDK Manager and check if the SDK Command-line tools are check. I check and the problem is still there. i tried to recheck and the problem is still there. Then I uncheck the Hide Obselete Package and see if the Android SDK tools(obselete) was check(according to BD Technic) and the problem IS still there.
So I decided to go use the Flutter Doctor --android-licenses and shows that the problem(screenshot) is this.
I went to the folder and see if maybe it was bugged/corrupted then I realized...I don't have the SDKmanager folder...
normally when you run this android-license it should run differently and show "Accept [y/n]" base on youtube videos I watched.
So my question is 2: How to fix "Exception:Gradle Task..."?knowing my license isn't working. I tried several guide and it has a similar problem. I'm not sure if having missing SDK Manager is the solution or maybe after you install the license it should be created instead. I have literally different problem compare to other people posting AndroidStudio errors when it comes to exception:gradle task
do I just need to reinstall the entire android studio? as well as the flutter.
you should check the following things:
Java JDK setup and add it (JAVA_HOME) to environment variables ( Windows operating system).
Install a Gradle and add it to the environment variables (GRADLE_HOME).
Install the SDK Android and to add it to the environment variables (ANDROID_HOME).
Then The command is executed in Flutter cmd
flutter doctor --android-licenses
I hope I helped you
source !
Never really used a piece of software that threw so many errors. I installed and got all the errors below so tried a fresh install, following a reinstall process to remove it completely, even including the SDKs but installing it again threw the exact same errors. From what I read it should just work after the basic install?
First error on opening it for the first time:
unable to access android sdk add on list
Even though right after installing I added it and approved it in my firewall.
Then during install it says HAXM failed to install, and it gives a link to install it which is a page not found. Then I found in the SDK Manager under tools it shows Intel x86 Emulator Accelerator (HAXM installer) 7.3.2 - Installed. From what I read that means it IS installed?
I'm using MacOS High Sierra and supposedly going to System Preferences > Security & Privacy and opting to allow this particular app should fix it, but since I already have it set to allow any apps that clearly doesn't fix it for me.
Then I added the Flutter plugin, created the default app and launched it and I got the error:
* Error running Gradle:
ProcessException: Process "/Users/hasen/AndroidStudioProjects/testing_app/android/gradlew" exited abnormally:
Starting a Gradle Daemon (subsequent builds will be faster)
> Configure project :app
Checking the license for package Android SDK Build-Tools 28.0.3 in /usr/local/Cellar/android-sdk/24.4.1_1/licenses
Warning: License for package Android SDK Build-Tools 28.0.3 not accepted.
Checking the license for package Android SDK Platform 28 in /usr/local/Cellar/android-sdk/24.4.1_1/licenses
Warning: License for package Android SDK Platform 28 not accepted.
Picked up _JAVA_OPTIONS: -Xverify:none
FAILURE: Build failed with an exception.
* Where:
Build file '/Users/hasen/AndroidStudioProjects/testing_app/android/build.gradle' line: 24
* What went wrong:
A problem occurred evaluating root project 'android'.
> A problem occurred configuring project ':app'.
> Failed to install the following Android SDK packages as some licences have not been accepted.
build-tools;28.0.3 Android SDK Build-Tools 28.0.3
platforms;android-28 Android SDK Platform 28
To build this project, accept the SDK license agreements and install the missing components using the Android Studio SDK Manager.
Alternatively, to transfer the license agreements from one workstation to another, see http://d.android.com/r/studio-ui/export-licenses.html
Using Android SDK: /usr/local/Cellar/android-sdk/24.4.1_1
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 13s
Command: /Users/hasen/AndroidStudioProjects/testing_app/android/gradlew app:properties
Finished with error: Please review your Gradle project setup in the android/ folder.
It says in this error output that I need to accept the SDK licence agreements but not sure how or why that needs to be done. The tutorials I followed didn't need to do any of this...not sure why it's so weird.
EDIT: Marked in error as a duplicate. It's not a duplicate because the solution from 3 years back does not work for me and I have two other errors which are not mentioned at all in the duplicate question.
In addition the solution to my problem was to remove the second installation of the Android SDK that was installed by Homebrew. None of this is mentioned in the supposed question this is a 'duplicate' of.
Let me clarify your comments first: I didn't downvote, but your wording leaves a lot to be desired. Android Studio is not my beloved anything, it's just a tool that I use for the lack of a more convenient one. What you're experiencing is not an Android Studio installation issue, this is an Android toolchain problem.
What's going on?
Your Android toolchain is broken.
What to do?
I'd take a few steps here to verify where is your problem originating, for it's hard to tell without being able to reproduce it. Instead, I'm going to tell you what steps I would follow if I encountered a fresh install of macOS (or any other OS, since I don't run macOS anymore).
Download Android Studio from Google.
Android Studio comes with some bundled basic stuff, but for the most part, it's recommended that you complete the missing keys, using the integrated SDK Manager. It's available in the very first Android Studio welcome popup that says "Welcome to Android Studio". Pick the "Configure" at the bottom and then "SDK Manager":
Notice at the top, my location where I saved all this; this must be set as ANDROID_HOME environment variable, and some of these folders must be in your Path (for easier access to any tool, notably the adb command). So if you use BASH (default for macOS High Sierra), ensure you add this to your .bashrc or .bash_profile or anywhere where you have configured your path.
export ANDROID_HOME="$HOME/Android/Sdk"
export PATH=$PATH:$ANDROID_HOME/emulator
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/tools/bin
export PATH=$PATH:$ANDROID_HOME/platform-tools
You get the idea.
Unfortunately, you also need Java, something macOS doesn't deliver these days anymore. So you have a bunch of choices here. You can head over to Oracle's downloads for Java 8 and chose the right one for your environment, or you can install the OpenJDK. In any case, if you need to see where you Java install(s) are, macOS has a handy tool called java_home. You can read more about it in this StackOverflow post.
java_home doesn't exist on my Linux, but I know where my java is, and I can see it because I added this environment variable, which is needed:
$ echo $JAVA_HOME
/usr/lib/jvm/java-8-openjdk-amd64
Now that I have that in my path, I can run the Java binaries:
$ java -version
openjdk version "1.8.0_212"
OpenJDK Runtime Environment (build 1.8.0_212-8u212-b03-0ubuntu1.19.04.2-b03)
OpenJDK 64-Bit Server VM (build 25.212-b03, mixed mode)
What about the licenses
The SDK manager is capable of approving the licenses from the command line in a semi-automated form because that's what Continuous Integration environments use. If your CI environment is freshly created for every pipeline (To ensure things work from fresh every time), then they, too, need to download the SDK and accept the licenses. That's where the SDK manager license enters the picture.
It's hard to tell what's going on with yours in particular, but rest assured, it's not a normal occurrence in my experience. It's mostly easy to realize that all it needs is a file in the right place to stop asking for approval, and what not. But all that is not needed if you use the SDK Manager UI because it will prompt you to accept the licenses right there in the UI.
After you have JAVA_HOME, ANDROID_HOME, etc. all set up. If you type adb --version, it should work, no matter where you are:
$ adb --version
Android Debug Bridge version 1.0.41
Version 29.0.1-5644136
Installed as /home/martin/Android/Sdk/platform-tools/adb
After all this, and assuming your Android Studio SDK pointer is pointing to the right place, then you should be good to go.
Keep in mind, projects can elect to use the embedded JDK (and in fact it says recommended) so if Java works for you, ignore the way I install Java :) (I prefer to use my own copy of the JDK, I got used to it). Remember this is a per-project setting.
How about HAXM?
HAXM is an Intel proprietary tool, and all Android Studio / SDKManager does is download but not install (as far as I remember). In any case, the official Google steps to install it on macOS, clearly say, on step 4 (and I quote the above link):
After the download finishes, run the installer. Typically, you can find the installer in the following location: sdk/extras/intel/Hardware_Accelerated_ExecutionManager/IntelHAXMversion.dmg
UPDATE
HAXM: this is an Intel Tool and it has security implications and requires elevated permissions (in the case of macOS, to install a kernel extension) among other things, so you must complete the installation on your own. The only thing the SDK Manager used to do was just download the file, I don't think it launches the install on its own. Installing HAMX is relatively straightforward now; you can even download it from Intel and install it on your own.
Regarding your Homebrew thing, I'm not sure what's going on but I haven't used Flutter to do Android Development, so my help here will be limited in that regard. I'd try to brew uninstall whatever is conflicting here or at least try to figure out why Flutter is pointing to the wrong SDK. Take my flutter advice as coming from someone who hasn't installed Flutter ever and is just guessing with no proof :)
I'm trying to use Cordova to build a hello world app and after adding ANDROID_HOME variable (You'd be shocked how long that took to figure out) all I keep seeing when building is this:
BUILD FAILED
Total time: 1 mins 6.679 secs Error:
/Users/vladdy/Desktop/laboratory/cordovaBackgroundApp/platforms/android/gradlew:
Command failed with exit code 1 Error output:
FAILURE: Build failed
with an exception.
What went wrong: A problem occurred configuring root project 'android'.
Failed to find target with hash string 'android-25' in: /Users/vladdy/Library/Android/sdk
Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Ok fair enough so let's go install it:
Waiting patiently for the install, and same error running cordova build.
I wonder what else we need to install? But look, it seems that Android Studio still has Nougat and 25 available:
Why is Android Studio not installing anything?
I can see why PhoneGap Build is so popular...
Edit:
cordova requirements is now broken reporting the following:
My ~/.bash_profile:
export ANDROID_HOME=/Users/vladdy/Library/Android/sdk/
Requirements?
If you don't need Android Studio, I recommend not downloading it, instead, as #Tom-Esendam also suggest, go for the command-line tool.
Android Studio and Command Line Tool
Direct download link of Command Line Tool for OSX (2017-03-21)
Proxy?
And if your behind a proxy server, don't forget to add it to the settings in the SDK Manager Settings.
What does the different programs and commands?
cordova build doesn't download any SDK's.
cordova prepare appends the necessary SDK files to the cordova build folders.
After download of Command Line Tool:
After unzipping it, set ANDROID_HOME to it's root, so you have:
build-tools
extras
platforms
platform-tools
system-images
tools
catalogs under the root.
Adding SDK's:
Then install SDK's with ./tools/android.
Android SDK Manager downloads the SDK's, so you check what you need and hit OK to download it.
Preparing the build
Make sure all proxy settings are set if your behind a proxy.
Before running cordova build run cordova prepare. This shouldn't be necessary, but least I need to run that even thou cordova build should include that.
I don't know about the mac version. But on windows you have a standalone sdk manager. If there is one on mac try that?
previously I can compile but after I updated my cordova something happended. I got this error.
FAILURE: Build failed with an exception.
* Where:
Script 'C:\Users\Jay\testproject\platforms\android\CordovaLib\cordova.grad
le' line: 64
* What went wrong:
A problem occurred evaluating root project 'android'.
> No installed build tools found. Please install the Android build tools version
19.1.0 or higher.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug
option to get more log output.
I downloaded all the required SDK, what is the problem here?
I had the same problem and this is how I fixed it. I had the build-tools version 20 installed but still was getting this error:
No installed build tools found. Please install the Android build tools
version 19.1.0 or higher.
So I created a directory named 20 within build-tools directory, and copied all the files from sdk\build-tools\android-4.4W\* to sdk\build-tools\20. The problem was fixed!
You will need to do two main things:
Install android build tools
Make them available in your shell, when run the ionic run command.
Installing the build tools (ver 19.1.0)
Open android development studio
Goto: Configure --> SDK Manager --> select "Android SDK Build-Tools
select the checkbox "Show Package details" (bottom right)
review the versions of this package, make sure the 19.1 is selected - u may use newer, but 19.1.0 works.
Click Apply to make the changes / install it
Make the build tools available in your shell environment
Edit ~/.bash_profile by using vi or other shell editor
vi ~/.bash_profile
Add the following lines:
export ANDROID_HOME=~/Library/Android/sdk
export PATH=${PATH}:~/Software/android-sdk-macosx/tools:~/Software/android-sdk-macosx/platform-tools"
(save the file, and exit)
Editing the file, makes sure that for each login those variables will be available, but as we are already in active session, you need to make it available for the current shell env, run the following:
. ~/.bash_profile
I was stuck with this error for several days, I didn't find any clear explanation
Till I find this link, https://tomspencer.dev/blog/2017/05/30/a-guide-to-installing-cordova-on-windows-10
uninstall gradle, cordova, ionic, and anything related then use the steps in the link above to install them all correctly. that worked with me