Cannot find build.xml (Android) - android

I've been looking for an asnwer for this for a little while now, but I cant seem to find it. I moved a NeBeans Android project over through perfoce and now I am getting the following error
****\ZYAndroidAPP\build.xml:81: Cannot find F:\Program Files (x86)\Android\android-sdk\tools\ant\build.xml imported from ****\ZYAndroidAPP\build.xml
Seems like the build information from Android is not being approriately set by
<import file="${sdk.dir}/tools/ant/build.xml" />
in in the build script of the project. I tried setting it to the correct path to the SDK and it gave me the same error.
Has anyone had this problem before?

Check two things...
A. Make sure your path is set properly in your local.properties file
sdk.dir=/Users/me/Documents/android-sdk-macosx/
B. Make sure your environment variable is set properly:
echo $ANDROID_HOME
If not, then set it:
export ANDROID_HOME=/Users/me/Documents/android-sdk-macosx/

As #Justin Breitfeller said the local.properties had a bad sdk path

If you are looking for an answer to this, check which android version your app is and which versions are available in the SDK. This error is thrown by netbeans if there is no matching SDK version.

I had the same problem and i found a solution :
the directory {sdk_dir}\tools wasn't here so :
download the sdk from the official website
copy/paste \tools directory on the first sdk directory

First way: find local.properties and change sdk.dir to a correct path where Android SDK is installed.
Second way: change <import file="..." /> to a correct path to SDK.

Related

SDK Location not found in android studio

I have just imported my eclipse project in android studio. it keeps my saying that
Error:SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable.
I have seen some tutorials of editing local.properties files but it didnt work. here is my project.properties file:
sdk.dir=E:\\Mod Eclipse\\adt-bundle-windows-x86_64-20130219\\sdk
Actual directory of my folder is :
E:\Mod Eclipse\adt-bundle-windows-x86_64-20130219\sdk
A quick note about this if trying to run a Facebook sample and this error pops up, make sure you select the build.gradle file in the root of Facebook sdk, for all the samples when 'opening an existing project'. I got this error when I tried to open the gradle for just the Scrumptious sample from the 3.22 SDK
If you are sure that you have assigned correct SDK path in project settings,
and you can see it in local.properties as well, but still getting this error then there are chances that you are missing something in you project.
I was getting the same error after looking in to my project I found settings.gradle was missing.
and then add following script to your apps build.gradle
You will not face this error any more. It worked for me may be gradle set up was the blocking issue
My problem was:
I cloned a project from github
I clicked open existing Android Studio project
I chose the path of the inner sample app instead of the containing folder.
So what you should do is:
close the project.
click open existing Android Studio project
select the parent folder instead of the sample app.
You should also change it on Project Structure.
Close the current project and you'll see pop up with dialog which will then proceed to Configure option.
Configure -> Project Defaults -> Project Structure -> SDKs on left column -> Android SDK Home Path -> give the exact path as you did on local.properties and select Valid Target.
There you go.
The simplest solution sometimes is just do the File -> Invalidate Cache / Restart.
If it does not help then go for the more complicated stuff, as suggested in other answers
You can add a local.properties with to set the sdk.dir like sdk.dir=/Users/roofe/Library/Android/sdk.
But please note below, which is very important,
add the local.properties to the uppermost path of the project. Here the uppermost have some difference with root path of a project.
For example in the below project, I just use the ijkplayer-example, but this module also used other module with different cpu architecture.
If I only add local.properties to ijkplayer-example will not work. Here will get sdk location issue for other module.
While I can add the local.properties to the ijkplayer directory, then when I try to open the ijkplayer-example project, there will auto create a local.properties for ijkplayer-example, and everything works well.
In my case, it was a fresh install with checkout from github.
Just close the checkout window.
Create a new project (not from git, just a fresh one).
exit the project.
checkout whatever you like
Its just the fastest way that I found.
So I had the same issue, and none of the answers given previously helped me. What I did was check for new API updates (in my case, I updated to API level 23) and the problem was fixed.
Sync project with Gradle files, It will modify the project's local.properties file.
In Android Studio, I just clicked on File and then Choose Project Structure or Ctrl-Alt-Shift+S. This'll clearly show you the Android SDK location and an input box where you can browse to the correct one if it is not correct.
I add just local.properties file where my project is located. In local.properties:
sdk.dir=C\:\\Users\\dglig\\AppData\\Local\\Android\\Sdk
such kind of path is there which is our Sdk path.
So just create local.properties file manually and inside this just copy the Sdk file location.
Probably local.properties file missing.
Copy a local.properties from an existing file and add it to your current project. That worked for me.
I installed the SDK again (from here for example :
https://www.mediafire.com/file/azbsqg6dmg7z7np/Sdk+tools+for+android+studio.rar/file
& it created the directory & the packages, after installation.
Now I open android studio & everything is normal.
Everything posted so far was helpful in an overall learning capacity. However, most of the time, fixing one problem created others. What ended up working for me was completely deleting the GitHub project .zip file and any unzipped files. Then I made sure the correct .zip file was re-downloaded and unzipped. When it came time to open it in Android studio, I noticed there were 2 folders with identical project file names, one being contained in the other. The first (or upper) one is actually the .zip file. Open the other one!

All my projects in eclipse are showing error?

I opened my eclipse SDK and there all my projects are showing some sort of error. It is showing error in the java files. Even the imports are throwing error.. Please help me with this....!
I even tried restarting it several times.
You should check in Configure Build Path -> Android and check which android version is selected and check whether your application manifest has same sdkversion specified in this path or not.If not same then select sdk version that you have given in manifest and rebuild your code.
try to change as below inside your project manifest file.
instead of
android:style/Theme.Holo.Light.DarkActionBar"
add
#android:style/Theme.Holo.Light.DarkActionBar
ie, android:theme="#android:style/Theme.Holo.Light.DarkActionBar
This will fix it..
Try updating your SDK, check whether you have a valid JRE and JDK path defined in Java Build Path. Check whether all your dependencies are all updated and properly linked.
Instead of re-installing Eclipse try changing your current Workspace directory and importing all your projects there.

SDK Location not found Android Studio + Gradle

I have seen this same thing posted quite a few times, but whenever I try to import my project to my new work laptop I keep getting this error.
I have pulled the project from git (which his btw running fine on my old laptop).
Then I went to the sdk manager, downloaded all the tools, and all the SDK's available.
In the welcome screen, I went to Configure -> project Defaults -> Project structure.
Android SDK Tab says the path for projects without local.properties will be /Applications/Android Studio.app/sdk
This is correct.
Under SDKs I have all the available SDK's visible.
Project SDK is set to API 18
Yet still I get this error when trying to build my project.
Can anyone tell me where I havent looked yet?
I am running gradle 1.7 when trying to build which is downloaded from services.gradle.org
I had very similar situation (had a project on another machine and cloned it to my laptop and saw the same issue) and I looked in it.
Error message was coming from Sdk.groovy of Android gradle plugin:
https://android.googlesource.com/platform/tools/build/+/master/gradle/src/main/groovy/com/android/build/gradle/internal/Sdk.groovy
By looking at code, its findLocation needs to set androidSdkDir variable and there are only three ways to do it:
create local.properties file and have either sdk.dir or android.dir line.
have ANDROID_HOME environment variable defined.
System.getProperty("android.home") - I'm not sure how it works, but it seems like a Java thing.
While your Android Studio knows that the SDK is at that place, I doubt that Android Studio is passing that information to gradle and thus we're seeing that error.
I created local.properties file at the project root and put the following line and it compiled the code successfully.
sdk.dir = /Applications/Android Studio.app/sdk/
creating local.properties file in the root directory solved my issue
I somehow lost this file after pulling from GitHub
this is how my local.properties file looks like now:
## This file is automatically generated by Android Studio.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must *NOT* be checked into Version Control Systems,
# as it contains information specific to your local configuration.
#
# Location of the SDK. This is only used by Gradle.
# For customization when using a Version Control System, please read the
# header note.
#Sat Feb 06 11:53:03 EST 2016
sdk.dir=/Users/****/Library/Android/sdk
I found the solution here:
http://xinyustudio.wordpress.com/2014/07/02/gradle-sdk-location-not-found-the-problem-and-solution/
Just create a file local.properties and add a line with sdk.dir=SDK_LOCATION
If none of the answers work for you which happened to me on macbook pro in one of the projects you can always try to run Android Studio with an alias command passing sdk.dir with each run:
alias studio='launchctl setenv ANDROID_HOME '\''/Users/username/Library/Android/sdk'\'' && open -a '\''Android Studio'\'''
To fix this problem, I had to define the ANDROID_HOME environment variable in the Windows OS.
To do this, I went to the System control panel.
I selected "Advanced system settings" in the left column.
On the "Advanced" tab, I selected "Environment Variables" at the bottom.
Here, I did not have an ANDROID_HOME variable defined. For this case, I selected "New..." and:
1) for "Variable name" I typed ANDROID_HOME,
2) for "Variable value", I typed the path to my SDK folder, e.g. "C:\...\AppData\Local\Android\sdk".
I then closed Android Studio and reopened, and everything worked.
Thanks to Dibish (https://stackoverflow.com/users/2244411/dibish) for one of his posts that gave me this idea.
Had the same problem in IntelliJ 12, even though I have ANDROID_HOME env variable it still gives the same error. I ended up creating local.properties file under the root of my project (my project has a main project w/ a few submodules in its own directories). This solved the error.
specifying sdk.dir=<SDK_PATH> in local.properties in root folder solved my problem.
I clone libgdx demo, can't import project. it also reminds like this.
Env:
Eclipse(Android-ADT)
window 7
so I create local.properties file at the project root, like following
sdk.dir = D:/adt-bundle-windows-x86/sdk
I hope this can help others!
Copy and paste the local.properties file from a project you created on your new computer to the folder containing the project from your old computer also works too if you don't want to (or know how to) create a new local.properties file.
I noticed that I get this error when I'm working on a new computer if I try to build from the command line first. However, if I build from Android Studio, it retrieves the SDK and creates the directory automatically. Then when I build from the command line it works.
You have also to ensure you have the correct SDK platform version installed in your environment by using SDK Manager.
If you have cloned a project from GitHub for example, and you've tried the methods mentioned here without success including:
Editing sdk.dir in the local.properties
Trying to set ANDROID_HOME environment variable
Or adding an alias as kasiara mentioned
You should try to see if you are trying to build a directory project that is a part within a bigger project, and so it may cause problems.
So load the entire project, and then run the project directory you'd like.
In my specific case I tried to create a React Native app using the react-native init installation process, when I encountered the discussed problem.
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> SDK location not found. Define location with an ANDROID_SDK_ROOT environment variable or by setting the sdk.dir path in your project's local properties file at 'C:\Users\***\android\local.properties'.
I add this, because when developing an android app using react native, the 'root directory' to which so many answers refer, is actually the root of the android folder (and not the project's root folder, where App.js resides). This is also made clear by the directory marked in the error message.
To solve it, just add a local.properties file to the android folder, and type:
sdk.dir=C:/Users/{user name}/AppData/Local/Android/Sdk
Be sure to add the local disk's reference ('C:/'), because it did not work otherwise in my case.

Who do anyone work with FBReader open source?

Newly, I want to work with FBReader. I took it's codes from github and download Android NDK and cygwin. But I have several problems.
I need your help for config and use these codes. I install Cygwin and try to config it but I get the following error in codes:
1. I get error in main.xml : "error: No resource identifier found for attribute 'fadeScrollbars' in package 'android' "
2. I get errors in src/... : " The import org.geometerplus.zlibrary.ui.android.R cannot be resolved " (for line: import org.geometerplus.zlibrary.ui.android.R; )
3. In HowToBuild file I don't understand which create 'local.properties' file and how to set address for sdk.dir && ndk.dir
4. In .bashrc file where should I insert parameters? (which line)
5. Does Android NDK should config? How?
I search and study a lot of, But I can't use FBReader. Could you help me, please?
By the way, I used Eclipse.
Thanks and Regards, Omid
you may build NDK using cmd.
ndk-build -C your_project_location
this link will help you.
This is what I did: I downloaded and extracted the NDK. Then I ran the NDK-build command on the project directory in CMD:
cd: <PROJECT SOURCE DIRECTORY>
<PATH-TO-NDK FOLDER>\ndk-build
After its built, follow steps inside of the FBBuilder readme. Setting the path are super easy. Create file local.properties in the root of FBReader project, and inside it enter the SDK and NDK paths just as shown in the readme. If you have winodws, your path would be something like this C:\android\android_ndk, etc.
Once you do that, you should come across the following error: org.geometerplus.zlibrary.ui.android.R is unresolved. This even I don't know how to fix. I'm currently researching this.
I was also getting the same problem. First try to resolve other issues in your project. This file is generated automatically by your sdk, so don't bother about that. Also the package name in your manifest file must be same as below:-
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.geometerplus.zlibrary.ui.android"
android:installLocation="auto"
android:versionCode="108021"
android:versionName="1.8.2" >
As soon as other errors will be resolved,sdk will create this file when you refresh project or clean the project.

Set classPath for java

I am trying to run the draw9patch.bat from my cmd but it throws the following error.
WARNING: Java not found in your path.
Checking if it's installed in C:\Program Files\Java instead (64-bit).
Checking if it's installed in C:\Program Files\Java instead.
ERROR: No suitable Java found. In order to properly use the Android Developer
Tools, you need a suitable version of Java JDK installed on your system.
We recommend that you install the JDK version of JavaSE, available here:
http://www.oracle.com/technetwork/java/javase/downloads
You can find the complete Android SDK requirements here:
http://developer.android.com/sdk/requirements.html
I have java installed and have also tried changing the classpath from environment variables in the control panel.However it does not seem to solve the problem.What am i doing wrong.
For that you need to set the 'path' environment variable.
Something like this:
path=%path%;c:\program files\java\jdk 1.6\bin
or
the path where you have installed the java.
You may need the swing-worker-1.1.jar, place this in Android-sdk/tools/lib directory.
For people who are looking for solution for Windows 7 (maybe for xp too) and that last answers wasn't the right solution.
If you have problem with running this file, this problem will happens in almost all .bat files in android-sdks/tools files.
Here is what to do and all that batch files will work okay.
I assume that you have downloaded proper JDK so..
Go to folder android-sdks\tools\lib and edit file find_java.bat
Delete all text stored inside and insert into something like that:
set java_exe="C:\Program Files\Java\jre7\bin\java.exe"
if not defined java_exe goto :CheckFailed
:SearchJavaW
set javaw_exe="C:\Program Files\Java\jre7\bin\javaw.exe"
if not exist %javaw_exe% set javaw_exe=%java_exe%
goto :EOF
Please be carefull and put correct path to jre what you have! Here is an example for jre7!

Categories

Resources