React Native Install Error - android

I am consistently running into the same error when I run "react-native run-android." Here is the error:
* What went wrong:
A problem occurred configuring project ':app'.
> failed to find Build Tools revision 23.0.1
I tried this --> failed to find Build Tools revision 21.1.1 - sdk up to date --> and got the same error.
I installed the android sdk with homebrew and my ANDROID_HOME export is in my .bash_profile and .zshrc file as:
export ANDROID_HOME=/usr/local/opt/android-sdk
When I go to this directory and look in the "build-tools" directory I do see 23.0.1.
Does anyone have any advice?
EDITS:
I'm also unable to run "react-native run-android" with any flags. I'm not seeing any output from stacktrace, info or debug.

Finally figured it out! Chris Geirman's answer is also valuable, so I would start there as I did. One thing to mention is that I installed React Native with Homebrew. If Chris's method does not work look into the following:
Go to your React Native project directory that is created by react-native init
Open the android directory.
Open the file local.propertiesIf you don't have this file you can make one.
Make sure the sdk.dir value is pointing to the correct directory. In my case the path need to be sdk.dir = /usr/local/opt/android-sdk
As an extra bit of reassurance I also located that directory above to make sure that the build tools version that was missing (23.0.1) was in that directory.
EDIT:
I found that this is a post install error. If you run react-native init and you don't have $ANDROID_HOME set, you will run into this error.

I found this in the book Learning React Native and thought you might find this quote helpful.
If you receive a warning about a missing package, run android and check to see if
that package is listed as “installed”. If not, install it. If it is installed, but React Native
can’t find it, follow the steps above to try and fix any issues with your development
environment. You should also check to make sure that your ANDROID_HOME environ‐
ment variable is properly set and points to your installation of the Android SDK. For
example, on my system:
$ echo $ANDROID_HOME
/usr/local/opt/android-sdk

Related

Install the Android build tools version 19.1.0

I run ionic run android and it starts to download lots of things except gradle that i downloaded it and set the path myself, now i have 2 question:
1: Should ionic framework always download lots of things with every new project?
and
2: How i resolve the below error , i set ANDROID_PATH variable to point Android-SDK where packages exist
What went wrong:
A problem occurred evaluating root project 'android':
No installed build tools found. Install the Android build tools version 19.1.0
or higher.
The answer is yes (through Gradle) and you have to set ANDROID_HOME and then add to PATH based on this.
On the Mac I had much the same problem. I was lacking the Android SDK. I don't know if that was your problem. I'll assume you don't have the SDK but you can pick up from your problem place in this list.
Download and install Android SDK for you platform. I'm on Mac so will present instructions from that perspective.
Go to Configuration on login splash screen or Preferences through File or Apple menu.
Go to Appearance and Behaviour > System Settings > Android SDK
Observe the Android SDK Location. Mine is /Users/me/Library/Android/sdk
Open ~/.profile
Add export ANDROID_HOME=/Users/me/Library/Android/sdk
Add export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
Save and source ~/.profile
You could have the additional problem of not having Gradle installed. Try:
Download the binary
Extract to /usr/local or wherever you can write (eg. ~/lib where I install such things locally) if you don't have admin rights
sym link the version of gradle - cd /usr/local;ln -s gradle-3.5 gradle
Add /usr/local/gradle to your $PATH like above and source ~/.profile again.
I reread the question and realised I had added too much detail in my answer. I believe the $ANDROID_HOME and path line is what you are missing.
You may also need to open Android Studio and do whatever configuration it requires. And setup a SDK Platform also in that configuration window discussed above.
I hope that helps.

"phonegap run android" phonegap 3 under windows can't build a project

I 'm trying to create a new project with phonegap3 :-
I set up the dev environment that include
node.js
Ant
Android SDK
and they all updated to the last versions
after creating the project , I get the directory for project:
EX :
phonegap create HelloWorld com.example.hello HelloWorld
but the main problem that I can't add the android platform to it
with the 3 comands as follow :-
trying to "phonegap add platform android"/"phonegap build android"/"phonegap run android"
I also installed throw the node the "cordova" and the same problem exists when I replace the phonegap with cordova !
Users\koko\test\www>phonegap build android
[ponegap] detecting Android SDK environment...
[ponegap] using the local environment
[onegap] adding the Android platform...
[error] An error occured during creation of android sub-project.
Users\koko\.cordova\lib\android\cordova\3.3.0\bin\node_modules\q\q.js:126
throw e;
^
Error: An error occurred while listing Android targets
at C:\Users\koko\.cordova\lib\android\cordova\3.3.0\bin\lib\check_reqs.js:87:29
at _rejected (C:\Users\koko\.cordova\lib\android\cordova
.........
at process._tickCallback (node.js:415:13)
I also uninstall the node and re-download it and the problem still exists !
I viewed many questions with people around this issue but I don't know where exactly the error !
I wish to see the project running inside the emulator !
It seems, that cordova failed to execute following command in shell:
>android list target
Why don't you try to execute it manually? It may produce more information about this problem.
Didn't you forget to add following folders to your PATH?
android-sdk/tools
android-sdk/platform-tools
EDIT:
The latest android SDK has different folder structure. note the "sdk" folder.
android-sdk/sdk/tools
android-sdk/sdk/platform-tools
Make sure, you have set the following system variables:
ANT_HOME = path to ant files
JAVA_HOME = path to java JDK (NOT JRE!!)
ANDROID_HOME = path to android sdk
After that, you have to add
%ANT_HOME%\bin
%JAVA_HOME%\bin
%ANDROID_HOME%\bin
to your PATH variable.
If it still doesnt work, make sure you have the Google USB Driver installed (this took me hours to find and fix -.-)

Cannot run program "sh": Launching failed

I downloaded cygwin and install. Then copy the ndk file to android folder. The path is C:\Program Files\Android\android-ndk-r9b then add this path to systemVaraible. Then choosen ndk location in Eclipse preference. Then right click the project, select AndroidToold->Add Native supportI'm getting this error: Build of configuration Default for project ImageTargets
(Cannot run program "sh": Launching failed)
Then open the cygwin terminal type $ cd /cygdrive/c/Program Files/Android/androi-ndk-r9b/samples/san-angles ndk-build
Below error i'm getting. Where i made mistake?
-bash: cd: /cygdrive/c/Program: No such file or directory
I had the same error on Windows and it was resolved by setting the correct path for Android NDK in the Eclipse workpace (Preferences->Android->NDK).
You don't need cygwin to work with NDK r9b on Windows. But whether you have cygwin installed or not, you should avoid spaces in the file names for your Android NDK or SDK installations. The easy fix would be to specify the path using short name, e.g. C:\Progra~1\Android\android-ndk-r9b.
See more at The Android emulator is not starting, showing "invalid command-line parameter", or Using Proguard for Android in Eclipse got Error.
the "Cannot run program "sh": Launching failed" may come from a bad eclipse configuration.
You can try to reset C/C++ Build configuration, inside your project settings:
Also on Windows, like Alex Cohn said, you don't need cygwin and can directly launch "ndk-build.cmd" script that is inside your NDK installation folder.

An error occurred during creation of android sub-project because a path is not found

I'm trying to do phonegap build android and I have this message :
[phonegap] detecting Android SDK environment...
[phonegap] using the local environment
[phonegap] adding the Android platform...
[error] An error occured during creation of android sub-project. Path not found
Phonegap is looking for "C:\Documents and Settings\corbg\.cordova\lib\android\cordova\3.0.0\bin\create". There is nothing under the directory "3.0.0". I installed cordova like this npm install -g cordova.
I have the some problem when I run cordova platform add android.
Did I missing something?
In Windows machine you have to delete .cordova directory under
C:\Users\user_name\
I have face the same issue, then i corrected my application path, afterthat it is worked out for me.
If you are using win 7 then add the Android ADK path in
open the mycomputer -> Properties -> Change Settings-> Advanced -> Environment Variable -> User variable for ....-> path
add the Android ADK path here like as following
C:\AndroidDev\adt-bundle-windows-x86-20131030\sdk\tools; C:\AndroidDev\adt-bundle-windows-x86-20131030\sdk\platform-tools
also add JAVA_HOME and ANT_HOME.
- Abdul Jabbar
Did you set your PATH variable? Sometimes this error occurs in Windows when the PATH variable is not set correctly to access "java" and "ant" exes. If you want to test if they are correctly set, you can simply execute both (from any folder in your command line):
> java
or
> ant
and both programs should be found.
It was a problem with my proxy. Cordova create a .cordova directory and try to download something on the internet. The download did not work. Next time, it check if there is a .cordova directory. It don't try to redownload something because the directory exist and it show the error.
I removed the .cordova directory and I solved my problems with proxy. Now, everythings works.
What solved the issue for me was having 2 directories on my PATH, the android platform-tools and tools.
In my pc those folders were at
C:\Program Files (x86)\Android\android-sdk\tools
C:\Program Files (x86)\Android\android-sdk\platform-tools
Also make sure you have the following environment variables
JAVA_HOME (C:\Program Files\Java\jdk1.7.0_51)
ANT_HOME (C:\Program Files\apache\apache-ant-1.9.3)
ANDROID_HOME (C:\Program Files (x86)\Android\android-sdk\platform-tools)
I removed the .cordova folder under my user folder but I'm not quite sure if that helped as well.
These links may help you
An error occured during creation of android sub-project
android' is not recognized as an internal or external command
I had the exact same problem for a different reason. I had an old version of ant (1.7.1). At least version 1.8.2 is needed for the build to work.
its either due to improper installation or no installation of ANT or JAVA. But moreover we need to add Android SDk and prepare Android Targets via SDK manager before going through this.
This is because you haven't installed ANT!
download it from here and install it step by step
https://ant.apache.org/manual/install.html
Then running the last command it will install the dependencies needed.

Android Maven Project on Jenkins

I have tried using Jenkins with my Android project which I'm using Maven for. I have tried following this tutorial except the emulator part since I don't have any tests (yet). http://vitorbaptista.com/continuous-integration-for-android-apps-with-jenkins-and-maven3/
I am getting the following error when I try building my project in Jenkins:
message : Failed to execute goal
com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.3.0:generate-sources
(default-generate-sources) on project ....: Execution
default-generate-sources of goal
com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.3.0:generate-sources
failed: Could not find tool 'aapt'. Please provide a proper Android
SDK directory path as configuration parameter
... in the plugin . As an
alternative, you may add the parameter to commandline:
-Dandroid.sdk.path=... or set environment variable ANDROID_HOME. cause : Execution default-generate-sources of goal
com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.3.0:generate-sources
failed: Could not find tool 'aapt'. Please provide a proper Android
SDK directory path as configuration parameter
... in the plugin . As an
alternative, you may add the parameter to commandline:
-Dandroid.sdk.path=... or set environment variable ANDROID_HOME.
Here is my configuration for Android and Maven:
Jenkins
(that folder is the right one, I've checked a million times)
Project
I have tried even chmod 777'ing the path to my SDK directory in the case Jenkins doesn't have access.
Any ideas?
Unfortunately, it was as simple as installing the platform tools. Since I have always worked with the SDK via UI, I haven't thought about the installation of the platform tools. After installing the platform tools, everything built.
The command was as simple as:
[sdkdir]/tools/android update sdk --no-ui --filter platform-tool

Categories

Resources