I grabbed a fresh copy of the eclipse ADT bundle today and now when I make a new app project the R folder fails to generate (As well as anything else in the gen folder. I also am unable to download API level 18 (Android 4.3).
Did anyone else run into this and if so how did you fix it / or is it something in regards to the switch from eclipse to android studio?
Check first
properties > Android
if any android version is checked
If ok
Then
properties > Java Build Path
check for added dependencies have correct path (Most probably not applied in your case)
If every thing is Ok then Resart Eclipse
Reconfigure your SDK path
Window >> Preferences > Android browse SDK directory
When I upgraded to Android ADT rev 22 I got to check Android Private Libraries in the tab Order & Export of the Java Build Path configuration screen. But I suppose it only apply if you depend on libraries. See this question for details.
Related
I have Eclipse Luna installed on my Mac and yesterday night I downloaded from the sdk manager the latest android sdk (v. 21 Android 5.0). Unfortunately after the update I got several errors that I tried to solve following the instructions in several posts here in Stack Overflow.
1. In java build path under Android Dependencies the jar file for Appcompact 7 was not found under the bin folder. I've read that this was due to the fact that I should have set 21 as the project target for the support library then clear and build the library project so that the jar file would be automatically created under the bin folder, but that didn't happened.
2. I added the jar file of the library under the bin folder manually. At this point instead of having the exclamation mark on the project name I have all the files under src folder marked with errors as the R file is not recognized anymore. I don't have any errors in any xml file, but still R resources are not found in the project.
3. Every time I try to change the target sdk for my project to 21 or 21 with google apis I get an error stating "Parsing Data for Google Inc.:Google APIs:21 failed Unsupported major.minor version 51.0". I've read that probably this is due to the jdk version installed on the computer so I updated it to the version 8 and changed the compiler in Eclipse to the 1.8 version. That didn't solve the problem so I got it back to 1.6.
4. In the problems tab I have the following errors:
- The import com.google.android.gms cannot be resolved;
- R cannot be resolved to a variable;
- the method initializePoolObject() of type DBObjectStructure must override a superclass method.
Do you have any idea of how to get to work again wthout any problems?
The import com.google.android.gms cannot be resolved
com.google.android.gms comes from the Play Services SDK, which you attach to your application project as an Android library
project. Please check your environment to ensure that you have a
valid copy of the Play Services library project and that your
application project still points to it.
Install a new Play Services:
Follow the instruction from Google to install
'google-play-services-lib' project.
This is the documentation.
R cannot be resolved to a variable
Make sure that your compiling and target versions are set to
21. Its because the new AppCompat only compiles on 21.
Right click the project and click "Properties". Then select "Android" from the tree on the left. You can then select the target target version on the right.
Note: Make sure your properties, classpath and project files are writable otherwise it won't work
The method initializePoolObject() of type DBObjectStructure must override a superclass method.
You have to update your jdk version into 1.8 to overcome this
error.Also change the java compiling version of your project into 1.8
in eclipse.
When creating a new project for Lollipop, Android Studio warned that java 7 is required. I know java 8 is not yet supported in Android, so that won't work, but I suggest you go with the latest update of java 7, perhaps the issue in Eclipse is the same, just the warning is missing.
to fix the R not identified error migrate to android studio. Version .8 should be sufficient evidence that the beta version is of release quality.
For eclipse delete the import myapp.R and then re-add them this has worked for me in the past.
Try use other IDE like Andorid Studio or InteliJ IDE, maximum resolves your error.
I just initialised a project on Android Studio, and it was working fine in version 0.2.6, but in 0.2.7, I get this error:
It creates a folder inside my Applications directory, but it does not initialize the project. Any help regarding this problem would be appreciated. I get no problems with version 0.1.1 through version 0.2.6, but when it comes to 0.2.7, things start to get problematic, like this and I can't even start a project.
With 2.7 update I got the same issue. It looks like now Android Studio thinks sdk lays in under its own folder at android-studio/sdk.
You should be able to use android app under android-studio/sdk/tools to get missing components (not tested).
Another solution would be to fix sdk path (tested):
Close any projects then drop to Welcome to Android Studio Dialog
Select Configure -> Project Defaults -> Project Structure
Select SDKs -> Android SDK -> Android SDK Home Path
Update it to your previous sdk location.
got the same problem when applying the last patch (2.7). I've resolved it by copying SDK Manager.exe from android-studio\sdk\tools\lib to android-studio\sdk\ then I've launched it and install the missing component.
After restarting Android Studio it works again !
You must manually run SDK Manager.
Folder: android-studio/sdk/tools
Search for android or android-sdk
The new Support Repository must be already selected, and you need only click the "Install" button.
Just as Leonidos said, install ASR through SDK Manager:
Tools > Android > SDK Manager ; Navigate to the Extras folder, and select Android Support Repositories.
Click install packages and it will work fine
I did a fresh install of Java, SDK and Android Studio, update it to 0.2.7 and install the ASR through SDK Manager, but the messages comes again.
So i found this solution.
The most common problem for Android Studio and 64Bit Windows System is the no 8.3 short path for
C:\Program Files and C:\Program Files (x86).
find_java.exe
couldn't handle it and give a wrong path back.
Finally do this:
dir /x C:
-- It shows no 8.3 short paths.
fsutil 8dot3name query C:
-- It shows NtfsDisable8dot3NameCreation is 1 on "C:",
means 8.3 short path won't be created in "C:".
Then I enable the generation of 8.3 short name by:
fsutil 8dot3name set C: 0
and create short names for C:\Program Files and C:\Program Files (x86) in windows recovery mode by:
fsutil file setshortname "C:\Program Files" PROGRA~1
fsutil file setshortname "C:\Program Files (x86)" PROGRA~2
And now dir /x C: can show the short names.
And now find_java.exe -s
can show the short path C:\PROGRA~1\Java\JDK17~1.0_2\bin\java.exe.
And now find_java.bat and android.bat can work good now!
source
Also copying SDK Manager.exe from android-studio\sdk\tools\lib to android-studio\sdk\
Just a few ideas to try that should hopefully help. These can be found by using Ctrl + Shift + A.
"Sync project with Gradle" - (it's also often in the toolbar with a green and yellow ball and a blue down arrow next to three android icons)
"Gradle" and select the ToolBox option; then hit the blue refresh icon to refresh all the gradle projects
"Project Structure..." (also available under File) Under the Libraries project settings you should see a valid reference to your support library. You'll also want to skim through everything to make sure everything else looks good with the project.
"Invalidate Caches..." (another available under File) Invalidate and restart. This one got me going again after the previous upgrade generated a bunch of errors.
Some of these may be redundant, but after having fought with similar issues in the past it's just a few easy things I've found to check.
If refreshing everything doesn't work you can always pull up the Android SDK from Tools -> Android -> SDK or from the toolbar with the blue/green boxy android that has a black down arrow. It should be next to the Sync Gradle button.
I update the Android Studio(AS) and see the same issue.
However, there is something slightly different about what I find out.
I actually have two sdks because I shift from Eclipse to AS.
Hence, I get one sdk in
c:\Program Files(x86)\Android\android-sdk
and anther in
c:\Android\android-studio\sdk.
And the real one that I use is in c:\Program Files(x86)\Android\android-sdk.
The important thing is that, I find that only one of the sdk setting is changed after the update.
Quick Start > Configure > Project Defaults > Project Structure
> Platform Settings > SDKs
1.7
JDK home path:
C:\Program Files\Java\jdk1.7.0_10
Android 2.2 Platform
Android SDK home path:
C:\Program Files(x86)\Android\android-sdk
Android 4.0.3 Platform
same as 2.2
Android 4.2.2 Platform
Android SDK home path:
C:\Android\android-studio\sdk <- it is modified after update!!!!
Android 4.3 Platform
same as 2.2
After fixing the path in 4.2.2, I could create new project successfully again.
For some reason, if you install Android Studio in the same directory as the SDK, this error will pop up. Just install it somewhere else.
For instance, I had it installed at C:\Android\, along with the SDK. Then, I decided to install it at C:\Program Files (x86)\Android Studio and it simply worked.
I installed new Android Studio 0.1.1 based on IDEA ide and tried Import code from Eclipse.
Go to Eclipse->Export->Grandle so it add gradle file
Open Android Studio and select Import Project and select my project folder with build.gradle file
Press Finish and get an Error: failed to find target android-15 (this is was parget of my project)
I go to system variables and change to %ANDROID_HOME% = d:\dev\android\android-studio\sdk\ (remove platform-tools from path)
And get new error: failed to find Build Tools revision 15.0.0
Also create another New Project and change Android SDK for it, but I still cant import project
I explore this problem and find the weak point: in file build.gradle I change next lines:
from compileSdkVersion 15 to compileSdkVersion "17"
from buildToolsVersion "15" to buildToolsVersion "17"
And it fix my problem with project import. I think it's problem in Eclipse export function. Build tools starts only from version 17 (in ADT 22), so it's imposible to find version 15.
Had same problem, now works. I did this:
Open android studio:
Tools -> android -> SDK manager then install the android 4.0.3 (API 15) and done.
It worked for me.
These simple steps worked for me:
Open new project (new not import)
Press F4
On the left Click on SDKs
Delete all SDKs
Click on +
Choose the SDK you are using for eclipse
Choose the right version
Click OK
Open your project using gradle file
Enjoy :)
This is an import problem. NOT an SDK Level issue.
You need version 22 of the SDK Manager before you attempt the export or it won't be in a format that Android Studio can consume.
Do you have updated SDK for Eclipse?
You need the Rev.22. After you downloaded it, you can Export the Project with a "build.gradle".
Migration of the Projects
Updating your SDK
Update SDK go to config settings, project settings then you will see SDK that isn't correct point to same place eclipse points to for SDK.
Worked for me.
Also it might help to reexport the project with new sdk
Update your android APIs using Android SDK Manager.It seems you have installed API lower than level 15.
For general 'import project' info, search for the word 'import' on
this install-guide document for Android Studio:
http://developer.android.com/sdk/installing/studio.html
EDIT: I've recently learned to use the 'import' dialog, so that I can
import projects from GitHub, which is very cool! (I first watched a tutorial
on YouTube titled 'git and github'). Then I learned that one needs to
use 'git' to "Clone" an entire GitHub repository (to bring a dir-tree full
of separate projects to your development machine). Then, you can navigate
into that sub-tree, to a given project of interest, and then use Android
Studio's 'import' dialog to play with that example project.
WOW, NEAT!
Hope this helps...
Had the same problem when Android studio 0.2.9 on mac and importing an old eclipse project:
By default, it uses /Applications/Android Studio.app/sdk as the android sdk location, instead of whatever you used to use.
On a per-project basis, you can go to the menu's File->Project Structure (command-;) and on the left you can change the project's sdk location.
To handle all projects (new or imported), before opening anything at the start screen click configure -> Project Defaults -> Project Structure -> (on the left) Android SDK to do the same. (re: https://stackoverflow.com/a/18409923/954643)
If you were starting from scratch without any android sdk setup and eclipse though, you'd have to download the missing SDKs via Tools->Android->SDK Manager.
I simply solved the problem by changing the project build target (Project properties->Android->Project Build Target).
In the file build.gradle change your compileSdkVersion to your current version. For me it is 23. Your buildToolsVersion would be the same number. Hence the only thing I had to do was
Change CompileSdkVersion 15 to CompileSdkVersion 23 in the build.gradle
From the quick start window, choose Configure, then choose Project Defaults, and then choose Project Structure. Then on the left under Platform Settings choose SDKs. Then to the right of that choose the current android platform, mine was Android 4.2.2 Platform, and delete it using the red minus button at the top, then add a new android platform using the green plus button at the top and point it to your current SDK folder and that is it.
I was working on an android tutorial and it wanted me to import the library from another project .The import worked and the project works correctly. But I noticed that doing that messed up several of my other projects (the ones that use Android 2.1) by apparently messing with the build path. Now instead of seeing "Google APIs [Android 2.1]" under the gen folder I see "Unable to get system library for project".
I verified the following:
I right-clicked the project and went to Properties I see that the correct Project Build Target is checked(Google APIs [Android 2.1]), but "Unable to get system library for project" is still shown above the assets folder and below gen and Android Dependencies. Cleaning all projects doesn't help.
How can I fix this problem?
is there a way to fix this issue globally or do I have to do it one by one?
I had the same problem. Try
Right click on your project
Go to properties
Click the Android section
Select a different target api (assuming one is already selected, as mine was - otherwise, select the one you want and jump to step 9)
Click OK
Do steps 1-3 again
Select your original target api
Click OK
Clean and build your project
Worked for me, anyway.
Derived the solution from:
"Unable to get system library for project" after I upgraded to Android SDK 2.3 and ADT 8.0
Error in .classpath on your project. It not connect to android sdk. Fix it and clean project. :-)
This happens when you are targetting an API version that for some reason is not mapped on your buildpath.
See which is the version of the SDK you are pointing to at the project.properties file.
Go to the SDK Manager at Window->Android SDK Manager
Check the Android API item that matches the version you want to use, OR, click on the latest one and then update your project.properties file.
Make sure your project build configuration is Project->"Build Automatically"
Retsart Eclipse (claning and rebuilding may not refresh all the project properties)
Borrowing from #Erhannis answer :
"
Right click on your project
Go to properties
Click the Android section
"
When I view the build target everything looked fine :
So I checked another build target , hit apply, and then re checked my original build target (Android 4.4.2) and re-hit apply. My project then compiled.
For me the project.properties file was missing (it was code from a repo I checked out). So I just created one with this line:
target=android-20
After that, Erhannis' solution worked for me.
Just for completing Erhannis answer: If you fixed the problem but it appears again when you restart Eclipse, then just go to the file local.properties on your workspace folder and verify that the location of the Android SDK there is correct.
At times, when only single Android SDK version is installed on your system, and if it gets changed either by un-installing / re-installing Eclipse, or otherwise (directly through SDK Manager), then this issue might crop up.
.
This is accompanied by the message like this on Eclipse console:
YourApp] Unable to resolve target 'android-22'
.
A simple workaround to this issue is:
Open AndroidManifests.xml of the project, and in the:
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="21" />
change the targetSdkVersion to the one currently installed on your system
Next, open the project.properties file and update
target=android-21
to your current SDK version
Finally, clean and re-build the project
Right Click on Project-> Select Android tools -> Select Fix Project Properties
This did the trick for me.
You need to click on the menu icon with the Android sitting in the grey box with a white arrow pointing down "Opens the Android SDK Manager".
or, from the command line, run:
%ANDROID_HOME%\tools\android sdk
I tried creating a new android application project in Eclipse (4.2 for Java) with latest android sdk as per http://developer.android.com/training/basics/firstapp/creating-project.html
I enter the application name and the project name. The other values are default.
After I click on finish on the final step, the window of creating a new project is still open. I have to click on 'X' to close the window. In the project explore, the new project is created but all the icon in front of files are in grey and there is no src file.
Could anyone help please? Thanks!
It seems that your MainActivity.java in "src" folder is not created at all.
You'll need to update the ADT.
Go to following:
'Help'->'Install New Software' and type
https://dl-ssl.google.com/android/eclipse/
Select ADT option and install it.
It will update the ADT.
Even I had the same problem and my issue got resolved with it!!
Make sure you have these things:
Java SDK Latest (or most popular, which is Java 7 at the moment even though 8 is available)
ADT
Eclipse is updated (via menu...Help > Check for Updates)
Check JDK Path
Via menu...Window > Preferences > Java > Installed JREs > [Point to path]
path should be similar to this for
x64: C:\Program Files\Java\jre7
x86: C:\Program Files x86\Java\jre7
x64[JDK]: C:\Program Files\Java\jdk1.7.0_45\jre
x86[JDK]: C:\Program Files x86\Java\jdk1.7.0_45\jre
When creating Android projects in Eclipse Kepler use a minimum API of 14 because there seems to be a bug causing Eclipse Kepler to crash (Other related issues: AppCompat! )