I have a project I created in Android Studio. I want to update the package name, packageName inside java files, inside xml files, Android manifest and in build.gradle. I am using this command:
android update project --path /pathToMyProject --package updatedPackageName
however this command gives an error Error: Flag '--package' is not valid for 'update project'.
So the question is how can I achieve my objective using command line so that I can automate the process?
Best Regards
The command-line android tool hasn't been kept up-to-date for Gradle-based projects like Android Studio uses, so you're better off not using it.
Use of android tool is deprecated; instead use sdkmanager:
androidsdk/tools/bin/sdkmanager --update
https://developer.android.com/studio/command-line/sdkmanager.html
Make sure you have the Android SDK Command line tools installed:
and then the path is: androidsdk/cmdline-tools/latest/bin/sdkmanager (default path for on a mac: ~/Library/Android/sdk/cmdline-tools/latest/bin/sdkmanager
Related
Im using cocos2d-x version 12 and NDKrc12 and I have all the paths in my
.bash_profile set. But when I build for android and type:
cocos compile -p android
It displays a message "There are not available platforms" which can't be because I have the android SDK installed in the correct path what is wrong?
On the latest version of cocos2d-x for some odd reason you need to use the '-s' option like this:
cocos run -s /Users/me/myprojects/mygame -p android
Otherwise without '-s' it displays "there are not available platforms"
seems unnecessary when your in your project folder but I guess it is!
Run android on the command line, this will open the Android SDK manager. From here make sure that you have installed the appropriate SDK for your device.
cd your project root, then open .cocos_project.json, find "android_cfg" arg, if you have the folder. if you don't find, then create a new cocos project, cocos compile, then judge which platform can run, in new project folder open .cocos_project.json. You can look for diffences between them.
In the build script of Samsung's Gear VR framework there's a line:
android update lib-project -p .
What's this "android" and where to get it? Obviously this is a bit hard to google :)
This tool can be found in the SDK. Take a look at this:
http://developer.android.com/tools/projects/projects-cmdline.html
You can find the android binary in $ANDROID_HOME/tools, $ANDROID_HOME is the path to the directory of your android sdk, you can either add it to the $PATH environment variable, or you can just cd to $ANDROID_HOME/tools then invoke ./android with required arguments
This is the android sdk tool.
It ships with android sdk and is located at <sdk directory>/tools/.
It supports library project update commands:
> android --help
> - create lib-project : Creates a new Android library project.
> - update lib-project : Updates an Android library project (must already have an AndroidManifest.xml).
While creating a Phonegap app using the Phonegap command line for the Android platform, I have run in command prompt like below:
C:\PhoneGapCL> phonegap create helloworld
C:\PhoneGapCL> cd helloworld
C:\PhoneGapCL\helloworld>phonegap local run android
And I got the following error:
[phonegap] adding the Android platform...
[error] The command android failed. Make sure you have the latest Android S
DK installed, and the android command (inside the tools/ folder) added to your
path. Output: 'android' is not recognized as an internal or external command,
operable program or batch file.
Try typing which android is if this does show /path/to/android then you need to set you path by PATH=$PATH:/path/to/android/platform-tools:/path/to/android/tools hope this helps
Try this: export PATH=${PATH}:/Users/myusername/path/to/android/sdk/platform-tools:/Users/myusername/path/to/android/sdk/tools:$JAVA_HOME/bin:$ANT_HOME/bin
Use the whole absolute path of your folder. Hope it helps.
I'm actually dealing with this error now
[error] An error occured during creation of android sub-project. An unexpected error occurred: "$ANDROID_BIN" create project --target $TARGET --path "$PROJECT_PATH" --package $PACKAGE --activity $ACTIVITY >&/dev/null exited with 1
Deleting project...
If you are sure that your PATH is set correctly and you still get this, try this.
Open Android SDK Manager and make sure to fully download latest Android API (for this moment it is API 18), then get all items from Tools and all items from Extras.
This solved this issue for me.
There is an issue with using API 18 of the Android SDK with PhoneGap. Using the Android SDK manager, download and install API 17. That should solve the problem. (Get rid of API 18 if it still doesn't work).
I am new to Ruboto gem. I am currently working on android with Ruboto. I know android. I have installed the all requirements for Rubuto. I try to created the sample project using following command,
$ ruboto gen app --package org.sample.rubotoapp --target android-17
Output: Android SDK not in path
/bin/sh: android: not found
Please anybody can solve my problem. Thanks....
It looks like the Android SDK tools directory is not in your path. If you check you path variable with
echo $PATH
it will probably not contain the Android SDK tools directory. Also, you can check if the "android" command is in your path using
which android
You will probably get an empty response.
If you use Ruboto 0.12.0, you should be able to use
ruboto setup
to configure your environment. Recently, in Android SDK r22, the path to the build tools was changed. This will break your setup, and you will have to add
<android sdk location>/build-tools/17.0.0
to your path manually. This is fixed for Ruboto 0.13.0 which will be released in june.
I would like to build an Android project from command line instead of using Eclipse. I have installed ant on my Windows Vista, and I would like to run ant release but I can't find the file build.xml in the root directory of my Android project.
The project has been created using Eclipse. Is there a particular reason why the file build.xml doesn't exist ? How to find/generate it please ?
Thanks.
Take a look at this doc wrt how to update an Android project:
https://developer.android.com/studio/tools/help/android.html