Moving Android SDK to another folder with Xamarin - android

I'm trying to move Android SDK from default folder (C:\Program Files (x86)\Android\android-sdk) to another drive. I already changed the following items in VS options to new path:
Tools | Options | Xamarin | Android SDK Location
Tools | Options | Cross Platform | C++ | Android | Android SDK
However, for some reason, Visual Studio still tries to run ADB from the old location. Where can I configure the new one?
Edit: ProcMon log
08:34:09,2974468 devenv.exe 9548 CreateFile C:\Program Files (x86)\Android\android-sdk\platform-tools\adb.exe PATH NOT FOUND Desired Access: Read Attributes, Disposition: Open, Options: Open Reparse Point, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a
08:34:09,2975321 devenv.exe 9548 CreateFile C:\Program Files (x86)\Android\android-sdk\platform-tools\adb.exe.exe PATH NOT FOUND Desired Access: Read Attributes, Disposition: Open, Options: Open Reparse Point, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a

Try this:
Open Registry Editor by selecting Run from the Start buttons context
menu, typing regedit in the dialog box, and choosing OK. Navigate to
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Android SDK Tools in the
folder tree on the left. Modify the Path registry variable to match
the path to your Android SDK.
From: https://msdn.microsoft.com/en-us/library/mt228282.aspx
It should work.

You may have environment variable set.
Please check by typing the SET ANDROID in a command window.
If so, you can change it from your environment variables.

Related

Failed to update Android SDK Package List - Unity 2019.2.10f1

When I try to export the game build for the Android platform, I started getting this error:
Within the Project Settings - Minimum API Level and Target API Level not get loaded anyhow!
While I have used all default Unity provided settings to export Android build.
Here is the image to illustrate this:
Now what to do to solve this error?
I have already read all the threads related to same problem but overall I can't able to find the solution that actually worked for me.
Project Settings > Player > Target API Level: Change "Automatic" to "Android 11" (or else)
Play once and Stop.
Change target api level to Automatic.
I don't know if the problem is the same, but this is how I handle it every time.
Edit: Now I just do this; I open the Other Settings Tab in Player Settings. Error appears in console. I Play and Stop it once and the error goes away (No need to change API Levels)
I just got the same error on MacOS using both Unity 2019.4.18.f1/2019.2.21.f1 and after a lot of messing around I think I might have figured some of it out.
At times ( don't know why ) Unity ( or something else ) starts resetting the JAVA_HOME environment variable to string empty when you start Unity. So even if you set JAVA_HOME via console or .bashrc/.zshrc depending on MacOS version it still doesn't work.
Some posts mentioned adding "/" to the end of the external tools SDK path. I think that just forces Unity to set the path again which makes it work for a while. But for me the the error just came back the second day.
I permanently fixed it adding an editor script to the Editor folder that changes the JAVA_HOME environment variable every time Unity starts/loads.
Here's the method for MacOS, just paste it in a C# script in the editor folder.
[InitializeOnLoadMethod]
static void SetJavaHome()
{
//Debug.Log(EditorApplication.applicationPath);
Debug.Log("JAVA_HOME in editor was: " + Environment.GetEnvironmentVariable("JAVA_HOME"));
string newJDKPath = EditorApplication.applicationPath.Replace("Unity.app", "PlaybackEngines/AndroidPlayer/OpenJDK");
if (Environment.GetEnvironmentVariable("JAVA_HOME") != newJDKPath)
{
Environment.SetEnvironmentVariable("JAVA_HOME", newJDKPath);
}
Debug.Log("JAVA_HOME in editor set to: " + Environment.GetEnvironmentVariable("JAVA_HOME"));
}
This worked for me :- Edit>Prefrences>In JDK Click copy path> then Uncheck JDK and Paste the copied path again in that and after OpenJDK add \
like this : Before : C:\Program Files\Unity\Hub\Editor\2020.1.3f1\Editor\Data\PlaybackEngines\AndroidPlayer\OpenJDK
After : C:\Program Files\Unity\Hub\Editor\2020.1.3f1\Editor\Data\PlaybackEngines\AndroidPlayer\OpenJDK\
If that doesn't works than uncheck JDK,SDK,NDK,Gradle and Stop Gradle (all five boxes) than close unity. Open Again and Check all five boxes again.
I don't know why, but on mac os unity may use latest version of java if you have one.
If you have installed a few versions of java, you can just remove all except java v1.8.
You can check which version of java you have by typing in terminal /usr/libexec/java_home -V.
You should have 2 or more versions.
If you installed them with brew, you can just use brew to uninstall extra java packages.
Also you can update JAVA_HOME system variable by type
echo export "JAVA_HOME=$(/usr/libexec/java_home -v 1.8)" >> ~/.zshrc.
This solution worked for me.

How to add android "SDK Update Site" via command line

I am using the android's sdkmanager commandline tool to update the SDK and I want to add an update site for addons. How can I do that only from commandline. I cannot use UX tool as I am accessing the host via ssh.
You will need to create this a file named repositories.cfg under your ~/.android/ folder.
Paste the following content into the file and modify it as needed.
### User Sources for Android Repository
#Tue Dec 12 15:45:09 PST 2017
disp02=Url1
disp01=Url2
disp00=Url3
count=3
enabled02=true
enabled01=true
enabled00=true
src02=http\://somewhere.com/some-extras-2/SomeArtifact2/some-extra-artifact.xml
src01=http\://somewhere.com/some-extras-1/SomeArtifact1/some-extra-artifact.xml
src00=http\://somewhere.com/some-extras-0/SomeArtifact0/some-extra-artifact.xml
Looks like still nothing better than writing a custom script to achieve these steps:
Download addon.xml
Parse it to get the location of a package archive[1]
Download package and extract to $ANDROID_SDK_HOME/add-ons
Convert addon.xml to package.xml and place it in addon directory in Android SDK
Here is my script to do this https://gist.github.com/CAMOBAP795/b5664b05ce2130de8192516fd4c4b9b0
Prerequisites:
- wget
- libxml2-utils
- xsltproc
[1] During development I observed that there are several XSD schemes, so my script doesn' cover all cases

How can I change the path to android\avd in my Android Studio

I have such exaption
InvalidPathException: Illegal char at index 9: C:\Users\??????\.android\avd\1.avd (show balloon)
when trying to create emulator. Can I change the location of directory .android?
Open control panel
Then go to System
Then go to Change Environment Variables of the User
Then click create a new environment variables
Create a new variable named ANDROID_SDK_HOME
Set its value to your Android directory, like
C:/users/<username>/.android
I tried suggested solution but did not work for me.
In my case I have to add a different variable so steps for me were:
Open Control Panel
Then go to System and Security
Then go to System
Then go to Advanced system settings
Then go to Change Environment Variables of the User
Then click create a new environment variables
Create a new variable named ANDROID_AVD_HOME
Set its value to your Android directory, like C:/users/<username>/.android
How can I change the path to android\avd in my Android Studio ?
Let say you want to move avd directory from it's default C:\users\<username>\.android\avd to D:\Development\avd
Move avd directory to desired location (ex. D:\Development\avd)
Change or add environment variable ANDROID_AVD_HOME : D:\Development\avd
On Windows: Control Panel > System > Advanced system settings > Environment Variables
If variable doesn't exits Click New... and fill with aforementioned data.
If variable exists then select variable, click on Edit... and replace variable value with the new path (ex. D:\Development\avd)
If you have already AVD, change avdName.ini to D:\Development\avd\avdName (ex. D:\Development\avd\Nexus_S_API_22.avd)
There is a simple way to move avd(in windows):
open the directory: C:\Users\Username\.android\avd, you will find the directory named with your AVD and a .ini file
move the directory to your desirable path, then change the path variable in the .ini file to the new location.
start the Android studio, you will find that the AVD can work properly.
Just move the emulator folder(folder that ends with .avd) to new location and keep the .ini file in same location then change the path to new location in .ini file.
No environment variable needed to be changed or added.
old path
path=C:\Users\nero\.android\avd\Android_Q.avd
new path
path=D:\androidemuators\avd\Android_Q.avd
You can keep your emulator anywhere just need to tell .ini config file where your emulator is located.
Simple with Image solution here, no need to edit Environment Variables here.
Go to C:\Users\<PCname>\.android and move the avd folder to
your desired location. Example D:\Programming\Android Studio\avd
Open avd folder and edit every .ini files, each one of these is represent to your emulator.
Edit file location. See image below for your reference.
Restart your Android Studio.
These are .ini files:
Old path:
New path:
Had the same problem. The reason was that ANDROID_AVD_HOME pointed to my user directory which had a space and umlaut in it. Obviously that causes some trouble with Android Studio.
So defining a system wide ANDROID_AVD_HOME point to d:\development\avd\ solved the problem.

Is it possible to allocate these folders in another place?

I am installing Android Studio and I have by default the path C:\Users\Administrator\AppData\Local\Android\sdk to set my SDK. If I choose this option, some folders appeared on the path C:\Users\Administrator.
These folders are:
.android
.AndroidStudio1.3
.oracle_jre_usage
.gradle
To be a little more cleaner I tried to wrap all these folders into another folder but each time I run Android Studio it gives to me the option to configure again the settings. If I configure them again, the folders re-appeared on the path C:\Users\Administrator.
What can I do to wrap these folders into another one or to set another location for them and that the settings will be saved?
EDIT: I prove the solutions on the blog of the answer provided by Rahul Tiwari but I only could get that the folder .android will be in the new folder. The rest folders are at the same location after the changes.
EDIT 2: According to the blog provided by Rahul Tiwari to move the folder .gradle I change the default settings of Android Studio:
File > Other Settings... > Default Settings... > Build, Execution, Deployment > Gradle
Here I have as Service directory path: C:/Users/Administrator/AndroidStudio/.gradle
But the folder .gradle still appears on the path C:/Users/Administrator.
EDIT 3: Trying to remove the folder .AndroidStudio1.3 I changed these lines:
#---------------------------------------------------------------------
# Uncomment this option if you want to customize path to user installed plugins folder. Make sure you're using forward slashes.
#---------------------------------------------------------------------
# idea.plugins.path=${idea.config.path}/plugins
#---------------------------------------------------------------------
# Uncomment this option if you want to customize path to IDE logs folder. Make sure you're using forward slashes.
#---------------------------------------------------------------------
# idea.log.path=${idea.system.path}/log
to these:
#---------------------------------------------------------------------
# Uncomment this option if you want to customize path to user installed plugins folder. Make sure you're using forward slashes.
#---------------------------------------------------------------------
idea.plugins.path=${C:/Users/Administrator/AndroidStudio/.AndroidStudio1.3/config}/plugins
#---------------------------------------------------------------------
# Uncomment this option if you want to customize path to IDE logs folder. Make sure you're using forward slashes.
#---------------------------------------------------------------------
idea.log.path=${C:/Users/Administrator/AndroidStudio/.AndroidStudio1.3/system}/log
but I also couldn't move the folder.
EDIT 4: This is the blog that I mention before (Thank you very much Rahul Tiwari). I post it here because his answer was deleted.
Thanks in advance!
Finally, I got the solution to move three of the folders that I put above. I think it could be interesting to put here the problems that I faced and the changes that I made to solve them.
I'm going to investigate about the last folder, .oracle_jre_usage, and I will complete this answer if I got a solution for it. Look that I complete the solution for .gradle folder.
To move .android folder
Really, following the steps of the blog that Rahul Tiwari provided, this folder could been moved. Nevertheless I'm going to put here all the process:
You have to move your .android folder, after closing Android Studio (if you have it running), to the folder in which you want that it will be stored, in my case, C:\Users\Administrator\AndroidStudio.
BEWARE WITH THE SPACES IN THE NAME OF THE NEW FOLDER, IT COULD GIVE TO YOU PROBLEMS (AS ME). I mean, Android Studio, New Folder or similars.
If you are on Windows, you can do right-click on My Computer > Properties > Advanced System Settings > Environment Variables and create a new environment variable named ANDROID_SDK_HOME and as value you have to put the new path in which .android folder will be stored. It's the same path in which you have moved the .android folder in the step above.
Click "OK" button to accept your changes.
Re-launch Android Studio and look that the .android folder doesn't appear in the default path.
To move .AndroidStudio1.3 folder
With that folder I had some problems because I didn't noticed some details that were very important. Here the steps that I followed:
First of all, you have to close Android Studio before doing any change.
After, you have to move the folder .AndroidStudio1.3 to the path in which you want that it will be stored.
Next, you have to go to the folder in which Android Studio were installed and open "idea.properties" file and changed the lines where idea.config.path and idea.system.path appeared for the new path in which these folders are going to be located.
They have to be something similar to this:
idea.config.path=C:/Users/Administrator/AndroidStudio/.AndroidStudio1.3/config
idea.system.path=C:/Users/Administrator/AndroidStudio/.AndroidStudio1.3/system
Here I had three problems so please be careful:
Notice that the paths are with / and not with \ as Windows put by default.
DON'T CHANGE the values of idea.plugins.path and idea.log.path (My EDIT 3). Be sure that you are changing idea.config.path and idea.system.path values.
Uncomment the lines in which idea.config.path and idea.system.path appears. I mean, remove the # that they have at the begining of each line.
The last step, re-launch Android Studio.
Searching and doing some proves I also get the solution to move .gradle folder. The steps are the same as .android folder but I put here all the steps (with the values that changed) to avoid any confusion. Here it is:
To move .gradle folder
You have to move your .gradle folder, after closing Android Studio (if you have it running), to the folder in which you want that it will be stored, in my case, C:\Users\Administrator\AndroidStudio\.gradle.
BEWARE WITH THE SPACES IN THE NAME OF THE NEW FOLDER, IT COULD GIVE TO YOU PROBLEMS (AS ME). I mean, Android Studio, New Folder or similars.
If you are on Windows, you can do right-click on My Computer > Properties > Advanced System Settings > Environment Variables and create a new environment variable named GRADLE_USER_HOME and as value you have to put the new path in which .gradle folder will be stored. It's the same path in which you have moved the .gradle folder in the step above.
Click "OK" button to accept your changes.
Re-launch Android Studio and look that the .gradle folder doesn't appear in the default path.
How to move data from %UserProfile%
The folders will still remain under %UserProfile%, but not the data.
Move .android
Android Studio is closed
Add Environment Variable
Create "System variable":
Variable name: ANDROID_SDK_HOME
Variable value: D:\Android
Move .AndroidStudio
This is a example with Android Studio version 3.1
Start Android Studio
Help -> Edit Custom Properties...
Click Yes to create file
Edit file with:
idea.config.path=D:/Android/.AndroidStudio3.1/config
idea.system.path=D:/Android/.AndroidStudio3.1/system
The file "idea.properties" is located under:
%UserProfile%/.AndroidStudio3.1/config
Close Android Studio
Delete all under %UserProfile%/.AndroidStudio3.1 except the file "/config/idea.properties"
Optional: Delete older version folders of .AndroidStudio
Don't edit "Android Studio/bin/idea.properties". When updating Android Studio this file is cleared.
Move .gradle
Start Android Studio
File -> Settings... -> Gradle
Change "Service directory path" to:
D:/Android/.gradle
Update Android Studio
Start Android Studio
"Import Studio settings from" is showed
Select: D:/Android/.AndroidStudio3.0/config
I think most of the others answers address the issue, But I found more simple way for windows by adding few environment variables . (Might work for mac as well, I didn't test though)
ANDROID_SDK_ROOT - path to the SDK installation directory
default path - C:\Users\XXXX\AppData\Local\Android\Sdk
Add enviroment variable ANDROID_SDK_ROOT - set value to desired location
Eg: =E:\Android\local\Android\Sdk
For .android folder
default path - C:\Users\XXXX\.android
Add enviroment variable ANDROID_SDK_HOME- set value to desired location
Eg: = E:\Android
For .gradle folder
default path - C:\Users\XXXX\.gradle
Add enviroment variable GRADLE_USER_HOME - set value to desired location
Eg: = E:\Android\.gradle
For .androidstudioXXX
Android Studio-> Help-> Edit Custom Properties
Add below lines
idea.config.path=E:/Android/.AndroidStudio4.0/config
idea.system.path=E:/Android/.AndroidStudio4.0/system
Add environment variable STUDIO_PROPERTIES - set value to desired location
Eg: = E:\Android\idea.properties
Finally don't forget to copy files from the original location to the new location.
Source : https://developer.android.com/studio/command-line/variables
Please see the end of the page to know how to add the environment variable on Windows, Mac or Linux
At least for Android 3.0 the steps in the accepted solution are not enough to be able to run the emulators after moving the .android folder (let's say you moved the folder from c:\Users\<username>\.android to I:\Programs\AppData\.android).
In addition you need to
Copy (or leave) files adbkey and adbkey.pub in old location (i.e. c:\Users\<username>\.android\adbkey, c:\Users\<username>\.android\adbkey.pub)
Replace the old location path string C:\Users\<username>\ in all .INI files found in the new avd location (i.e. in I:\Programs\AppData\.android\avd) with the new location path string I:\Programme\AppData\
Delete all *.qcow2 files from the new avd location (i:\Programme\AppData\.android\avd) which contain the old location path string c:\Users\<username>\. Check Qcow2-files refer to incorrect/nonexistent base-images for an alternative to delete the *.qcow2 files. If you delete the files all data in the emulator is lost, in this case you will get a clean version of Android, like after a hard reset.
To change default .gradle folder using Android Studio 2.2
Open folder of .AndroidStudiox.x (x.x is the version you use) -> config -> options -> gradle.settings.xml file
just right click to open it with wordpad, you should only see 1 option name = serviceDirectoryPath, change the value of that to desired path
remember use / not backward slash \ for folder even in Windows OS
I use junction.exe from Sysinternals to make my Java/Android Studio fully "portable" in Windows:
I have "AndroidStudio" installed in a folder "work".
I have "Java\jdk1.8.0_77_x64" in the same "work".
In the same folder "work" I copied the original ".android", ".AndroidStudio2.2" and ".gradle" folders (from C:\Users\<YourProfile>).
Then in the same parent folder "work" I have copied "junction.exe".
Finally in the same "work" I have a batch __init__.bat with content listed below.
Closed Android Studio and deleted original ".android", ".AndroidStudio2.2" and ".gradle" folders (from C:\Users\<YourProfile>).
Run __init__.bat (as Administrator to set also the JAVA_PATH via setx) to create the new junctions then restart Android Studio. This solution works also after I reimage Windows, just have to remeber to run first the mentioned bat...
PS: When I update java or upgrade Android I have to remeber to tweak the bat with the new revision numbers
Content of __init__.bat:
#echo off
#SET mySrcPath=%cd%
#rem echo "%myPath%"
#rem JAVA_HOME = D:\work\Android\Java\jdk1.8.0_77_x64\
#SET myJavaTarget=Java\jdk1.8.0_77_x64\
#SET myJavaPath=%mySrcPath%\%myJavaTarget%
#if not exist "%myJavaPath%" (
#echo CANNOT FIND myJavaPath = "%myJavaPath%"
#goto _exit_
)
#rem echo myJavaPath = "%myJavaPath%"
#setx JAVA_HOME %myJavaPath%
#SET myTargetPath=%USERPROFILE%
#SET myCopy1=.android
#SET myCopy2=.AndroidStudio2.2
#SET myCopy3=.gradle
#SET mySource1="%mySrcPath%\%myCopy1%"
#SET mySource2="%mySrcPath%\%myCopy2%"
#SET mySource3="%mySrcPath%\%myCopy3%"
#SET myTarget1="%myTargetPath%\%myCopy1%"
#SET myTarget2="%myTargetPath%\%myCopy2%"
#SET myTarget3="%myTargetPath%\%myCopy3%"
#rem echo.
#if not exist %mySource1% (
#echo CANNOT FIND mySource1 = %mySource1%
#goto _exit_
)
#if not exist %mySource2% (
#echo CANNOT FIND mySource2 = %mySource2%
#goto _exit_
)
#if not exist %mySource3% (
#echo CANNOT FIND mySource3 = %mySource3%
#goto _exit_
)
#if not exist %myTarget1% (
#echo creating myTarget1 = %myTarget1% from mySource1 = %mySource1%
#junction.exe %myTarget1% %mySource1%
) else (
#echo myTarget1 = %myTarget1% ALREADY EXISTS !!!!!!
)
#if not exist %myTarget2% (
#echo creating myTarget2 = %myTarget2% from mySource2 = %mySource2%
#junction.exe %myTarget2% %mySource2%
) else (
#echo myTarget2 = %myTarget2% ALREADY EXISTS !!!!!!
)
#if not exist %myTarget3% (
#echo creating myTarget3 = %myTarget3% from mySource3 = %mySource3%
#junction.exe %myTarget3% %mySource3%
) else (
#echo myTarget3 = %myTarget3% ALREADY EXISTS !!!!!!
)
:_exit_
#echo exiting...
#pause

SDK Manager is executing in cmd but not opening

Config Details:
Windows 8 Pro 32bit
adt-bundle-windows-x86-20130717
jdk-6u26-windows-i586 32bit
Directories:
For Java - C:\Program Files\Java\jdk1.6.0_26
For Android Root - Z:\Program Files\Android
For Android SDK - Z:\Program Files\Android\sdk
Environmental Variables:
var_name: JAVA_HOME
var_value: C:\Program Files\Java\jdk1.6.0_26\
var_name: JDK_HOME
var_value: C:\Program Files\Java\jdk1.6.0_26\
var_name: Path
var_value: C:\Program Files\Java\jdk1.6.0_26\bin
Modification:
1)
set java_exe=
"%JAVA_HOME%\bin\java.exe"
if not defined java_exe goto :EOF
2)
for /f %%a in ('"%~dps0\find_java.exe" -s') do set java_exe=%%a
3)
for /f %%a in ('"%~dps0\find_java.exe" -s -w') do set javaw_exe=%%a
First i downloaded adt-bundle then extracted into Android Root directory (i installed java far earlier) then i installed ADT Plugins from https://dl-ssl.google.com/android/eclipse/ and successfully connected Eclipse IDE with Android SDK. Now i am trying to Android SDK Components but when i clicked on Window-> Android SDK Manager in Eclipse a dialogue box opened said SDK Manager will open in a while but it didn't. Whenever i try to open SDK Manager everytime a cmd prompt for a second then disappear and nothing happened while AVD Manager open properly.
Then i went through some solution in several forums and modified some line of code (as of modification 1 in tools\android.bat ; 2 and 3 in tools\lib\find_java.bat)
Now in command line
Z:\Program Files\Android\sdk\tools>android
Usage: java [-options] class [args...]
(to execute a class)
or java [-options] -jar jarfile [args...]
(to execute a jar file)
where options include:
-client to select the "client" VM
-server to select the "server" VM
-hotspot is a synonym for the "client" VM [deprecated]
The default VM is client.
-cp <class search path of directories and zip/jar files>
-classpath <class search path of directories and zip/jar files>
A ; separated list of directories, JAR archives,
and ZIP archives to search for class files.
-D<name>=<value>
set a system property
-verbose[:class|gc|jni]
enable verbose output
-version print product version and exit
-version:<value>
require the specified version to run
-showversion print product version and continue
-jre-restrict-search | -jre-no-restrict-search
include/exclude user private JREs in the version search
-? -help print this help message
-X print help on non-standard options
-ea[:<packagename>...|:<classname>]
-enableassertions[:<packagename>...|:<classname>]
enable assertions
-da[:<packagename>...|:<classname>]
-disableassertions[:<packagename>...|:<classname>]
disable assertions
-esa | -enablesystemassertions
enable system assertions
-dsa | -disablesystemassertions
disable system assertions
-agentlib:<libname>[=<options>]
load native agent library <libname>, e.g. -agentlib:hprof
see also, -agentlib:jdwp=help and -agentlib:hprof=help
-agentpath:<pathname>[=<options>]
load native agent library by full pathname
-javaagent:<jarpath>[=<options>]
load Java programming language agent, see java.lang.instrument
-splash:<imagepath>
show splash screen with specified image
Z:\Program Files\Android\sdk\tools>
As you can see that my attempts are successful and android.bat is executing but the problem is when i try to open SDK Manager directly or via IDE again nothing happened but executing in cmd. I cannot understand what happening actually and i am unable to found anything related with this in any forum. Please Help. Thanks in advance.
In your PATH environmental variable, move *C:\Program Files\Java\jdk1.6.0_26\bin* to the beginning of the collection, and see if that addresses the issue.
Most likely the directory structure of your sdk installation changed. Try running android.bat from the sdk directory
Z:\Program Files\Android\sdk>tools\android.bat
If the sdk Manager opens (close it) and set the work_dir in android.bat to the sdk directory. In android.bat change line
set work_dir="%cd%"
to
set work_dir="Z:\Program Files\Android\sdk"
or to
set work_dir="%~dp0.."
If the above does not work try to get more information what is wrong in calling java, output the java call to the console. In android.bat change line
call %java_exe% .....
to
echo call %java_exe% .....
Good luck
android.bat seems to have a problem running from a samba share mounted on my windows system. This fixes the problem for me.
V:\>android
Usage: java [-options] class [args...]
(to execute a class)
or java [-options] -jar jarfile [args...]
(to execute a jar file)
[snip]
V:\>c:
C:\Users\me>android
I had this same problem and I found that none of the "set" commands in beginning of the batch file worked correctly.
prog is set to ~f0.
work_dir is empty
cd /d ~dp0 results in an error "The filename, directory name, or volume label syntax is incorrect."
Android.bat requires command extensions enabled in order to run correctly.
Restore the original batch file and edit this line
from...
setlocal
to...
setlocal enableExtensions
This should set all the environment variables correctly so that they don't need to be hard coded.
You can also enable command extensions in the registry. Reboot after making this change.
HKEY_CURRENT_USER\Software\Microsoft\Command Processor\EnableExtensions = 1

Categories

Resources