I've just set up my first Android development environment consisting of
Eclipse 3.5
Mac OSX 10.5
Android SDK for x86 macs
ADT Eclipse plugin 0.9.6
I've set set $PATH to my SDK/tools directory (which shouldn't matter if I only use Eclipse right?) and started Eclipse, but when I try to set the path to the SDK in Eclipse, i get the error "parseSdkContent failed". The stack trace of from the thrown exception is
java.lang.IllegalArgumentException: http://www.w3.org/2001/XMLSchema
at javax.xml.validation.SchemaFactory.newInstance(SchemaFactory.java:181)
at com.android.ide.eclipse.adt.internal.sdk.LayoutDevicesXsd.getValidator(Unknown Source)
at com.android.ide.eclipse.adt.internal.sdk.LayoutDeviceManager.parseLayoutDevices(Unknown Source)
at com.android.ide.eclipse.adt.internal.sdk.LayoutDeviceManager.loadDefaultLayoutDevices(Unknown Source)
at com.android.ide.eclipse.adt.internal.sdk.LayoutDeviceManager.loadDefaultAndUserDevices(Unknown Source)
at com.android.ide.eclipse.adt.internal.sdk.Sdk.<init>(Unknown Source)
at com.android.ide.eclipse.adt.internal.sdk.Sdk.loadSdk(Unknown Source)
at com.android.ide.eclipse.adt.AdtPlugin$13.run(Unknown Source)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
I can't see that I've missed anything in the setup process, according to the instructions it should basically just work out of the box. Any ideas as to why this might fail?
So my solution was completely different. The project.properties was corrupted. I had to edit it from the command line as eclipse didn't want to do anything for me. I deleted everything that was unnecessary. So that the file looked like this:
# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must be checked in Version Control Systems.
#
# To customize properties used by the Ant build system use,
# "ant.properties", and override values to adapt the script to your
# project structure.
# Project target.
target=android-15
Closed Eclipse. Opened it again.
I then went back into the project properties and reset my libraries. This solved the problem. Hope this helps someone else!
For me updating the DDMS from ADT plugin did the trick!
Before that for saving time I only updated ADT plugin, nothing else like Android DDMS, TraceView etc. so I ran into same issue, after couple of restarts and Google searches everyone was proposing different solutions. I updated my Android DDMS and restarted eclipse.
And It worked like a charm.
I didn't had to remove my workspace or update my .project file etc.
Step 1. Find the folder named: .android
This folder can be located in your Windows user directory, for example in Windows 8:
C:\Users\YOUR_WINDOWS_USERNAME.android
Step 2. Delete this folder .android
Step 3. Restart Eclipse and it is OK now
A quick glance at http://java.sun.com/javase/6/docs/api/javax/xml/validation/SchemaFactory.html suggests that something is wrong with the JDK 1.6 setup.
Setting the -vm flag in eclipse to the original 1.5 did not help, but after removing all traces of the apparently misconfigured 1.6 everything worked like a charm.
I try removeing all your projects then restart the application
Installed API 19
Deinstalled API 20, 20L
Under Package Explorer|appcompat_v7 Android 4.4.2 didn't show up
Then removed corresponding 20-and 20L-folders in sdk/platforms and sdk/system-images
Restart and ok
ADT Package 23.0.2.1259578
Eclipse Platform 4.2.2.M20130204-1200
On Windows 7 with adt-bundle-windows-x86_64-20140702:
removing
C:\Users\YOUR_WINDOWS_USERNAME.android
did the magic for me :)
Related
Android Studio (v2.2 Preview 3) suddenly failed to update the tools. It keeps giving the error pasted below:
To install:
- LLDB 2.2 (lldb;2.2)
Preparing "Install LLDB 2.2".
Failed to read or create install properties file.
Failed packages:
- LLDB 2.2 (lldb;2.2)
I gave the folder full permissions. Ran android studio on administrator mode. End-tasked adb from task manager. Disabled antivirus. Deleted the folder and then ran the update again. But nothing works.
I also tried to create a new sdk location on my drive. But then that failed to, it gave the same error as above. -> Failed to read or create install properties file.
Any ideas?
I also encountered the same error when trying to update build tools after upgrading Android Studio. Unfortunately, in my case, removing .AndroidStudio2.x folder and re-opened studio with no config imported didn't work.
But then inspired by this answer, I go to Android Studio folder, then to bin folder, right-clicked on studio64.exe, choose Run as administrator. Then when I tried to update the build tools, it worked.
I'll just leave it here as an alternative way in case someone encountered the same problem.
For some reasons, this happens when you import the settings when upgrading Android Studio.
The fix is to delete the .AndroidStudio2.1 or .AndroidStudio2.2 folder in your profile directory. Open android studio and don't import any config.
This will however will ask to download the supporting libraries again.
In Windows 10, I pinned the application to my taskbar, and right-clicked on the icon and chose the option to run as administrator. Then I went through the steps to download my SDKs. Everything worked as it should.
Using Windows7: I unzipped the SDK under C:\Program Files\... but eventually discovered that security permissions in the "Program Files" area prevented sdkmanager.bat from creating folders and files.
It looks like you can give sdkmanager.bat permissions, but there are many complications, especially in cmd.
So I moved the SDK to C:\Users\[admin_name]\.android (or any folder) where it's easy for the sdkmanger to create folders and files and it finally worked !!
Hope this helps someone. Thank-you to all those who have helped me.
When using the sdkmanager command in Linux, you have to run it as root:
sudo sdkmanager --install emulator
On Linux, It's a permission issue. You can resolve the problem quickly by launching Android Studio as root :
gksudo <path_to_file_studio.sh>
If you want to fix this problem on long term and in more secure and better way you should find the right files / folder to alter and change their permissions. I didn't point it for now.
This solution was tested on Debian, but I guess it works on Unbuntu, Mint ...etc.
You cannot edit local.properties it is a generated file, right click your project and select 'Open Module Settings' under SDK Location put your location for your SDK.
paste in /Users/gururaj/Library/Android/sdk
Clean and rebuild your project
Update
Try to delete your local.properties file and create a new one, but do not check it into version control.
Right click top level of project and Create new file 'local.properties' then add: sdk.dir=/Users/gururaj/Library/Android/sdk
Clean and build
It worked for me to uninstall everything, delete the directories created in Program Files and Program Files (x86) and reinstall in another directory.
I downloaded Android Studio version [build 135.1653844] and created a new project. I am getting an error:
Failed to complete Gradle execution.
Cause:
The newly created daemon process has a different context than expected.
It won't be possible to reconnect to this daemon.
Context mismatch: Java home is different.
Wanted: DefaultDaemonContext[uid=null,javaHome=C:\Program Files\Java\jdk1.6.0_45,daemonRegistryDir=C:\Users\gargn\.gradle\daemon,pid=1000,idleTimeout=null,daemonOpts=-XX:MaxPermSize=256m,-XX:+HeapDumpOnOutOfMemoryError,-Xmx1024m,-Dfile.encoding=windows-1252,-Duser.country=US,-Duser.language=en,-Duser.variant]
Actual: DefaultDaemonContext[uid=9a6c3945-1d55-46d7-897b-4ed84a5707bb,javaHome=C:\Program Files\Java\jdk1.6.0_45\jre,daemonRegistryDir=C:\Users\gargn\.gradle\daemon,pid=1664,idleTimeout=10800000,daemonOpts=-XX:MaxPermSize=256m,-XX:+HeapDumpOnOutOfMemoryError,-Xmx1024m,-Dfile.encoding=windows-1252,-Duser.country=US,-Duser.language=en,-Duser.variant]
My Java home is set to C:\Program Files\Java\jdk1.6.0_45 and I could not find any setting where I am using the jre path. I searched in all text files and could not find jre path as shown in the error above.
Though I did not find the root cause where the different javaHomes have been taken from, at least I found a workaround that worked for me:
Try setting the following in your gradle.properties (either in %USERPROFILE%\.gradle\ or in your project build dir):
org.gradle.java.home=C:\Program Files\Java\jdk1.6.0_45\jre
I deleted the jre from the installation file of inttellij, but when I tried to run intellij, i said that I tried to run a 32bit version of intellij, but no jre for 32bit was found, then I when to the intellij installation directory and run a 64bit version, and the problem was solved.
Another answer for people looking for a solution:
In my case, I did not have any 32 bit JVMs installed, so I ran IntelliJ in 64 bit mode instead, and everything worked fine after I set my IDEA_JVM_64 environment variable.
Bit Late,But will be helpful for someone,
For me the problem was solved by uninstalling all jdks and installing only one and setting JAVA_HOME for that jdk in my case
JAVA_HOME
C:\Program Files\Java\jdk1.7.0_40
Thats All
This error appear most likely downloading applications (such as Oracle, Application servers...) that include java version or installing another JDK/JRE.
I managed to solve the this problem by deleting/renaming all JDK/JRE and forders and only keep one and only one JDK folder and contains JRE folder inside.
also I put the JDK path into JAVA_HOME and path vatiables and remove any other JDK/JRE paths from the environment variables.
After that reset the JDK home in your IDE.
Regards,
Mohammed Kharma
I managed to solve this problem by renaming Info.plist and version.plist to Info.plist.old and version.plist.old in /Applications/IntelliJ IDEA.app/Contents/jre/jdk/Contents folder on Mac.
Executed
mv Info.plist Info.plist.old | mv version.plist version.plist.old
in folder mentioned above. Then I just run Intellij and things were working fine. Probably, it would be possible to fix this by renaming only one of these files but I haven't tested it. After fixing it I haven't rename files back to Info.plist and version.plist. Should I?
After this fix, I also created idea.properties file in ~/Library/Preferences/IntelliJIdea2016.2 and added line gradle.java.home=$(/usr/libexec/java_home)
I am facing a problem when I try to create new android project in eclipse adt plugin tools.
ERROR/EXCEPTION::
Errors occurred during the build.
Errors running builder 'Android Resource Manager' on project 'test'.
java.lang.NullPointerException
I have faced this problem two times previously. Only solution was to re-install Windows operating system which actually did solve the problem. But I want a real solution without re-installing Windows.
Switching to a new workspace worked for me.
File-> Switch Workspace.
found a better solution. in the create project wizard. don't create an activity in the wizard. just untick create an activity and just create the activity manually in the manifest.
I guess you upgrade your java to java7u55.
because I am using mac, but, FYI
I solve this by edit eclipse.ini, force the ide to use java 1.6
-vm
/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Commands/java
you could try the same.
In my case, the error was solved by changing the workspace folder permissions with chmod 777.
I am using Mac OS X and downloaded the ADT bundle for Mac.
If you close eclipse and then look in your system processes and still see adb running, then that's the problem - it crashed. In my case it was because I have extension files for other programs in my JRE that the adb doesn't seem to like. Remove all your ext files, force shut down your adb.exe and then restart eclipse.
Root exception:
java.lang.NoClassDefFoundError: org/apache/log4j/Priority
Usually this means that they have one more time introduced a bug.
The "magic passes" that may help or not help are:
Pressing F5 (refresh)
Updating Android, Eclipse and ADT (knowing that you do have such a problem, I myself definitely will not do any such updates in the near future)
Creating a project from the command line, building it and trying to import
If you have any project that already works, you may try to take files from that project.
Read the logs, they are usually more informative than just the last 30 lines, but on Windows you will have to either configure the screen buffer height to be about 300-600, or redirect the output to a file.
Clean and build again.
You usually get this after an SDK/ADT update.
Go to your SDK manager and ensure that there are no updates. Then in Eclipse go to Help > Check for Updates and install any updates it finds.
Restart eclipse and hopefully it should all work.
Failing that uninstall Eclipse and re-install Eclipse and the plugins again should fix it as well, no need to re-install your whole PC.
I use maven to build and integrate android projects with jenkins/netbeans. For editing android resources, I often use Eclipse because of the ADT plugin and better android resources support.
Eclipse (Kepler) has serious problems when you import maven-based android projects. It expects the project.properties file in the root folder and will NOT generate it on its own no matter what. Example content:
# this file is needed by eclipse (adt plugin).
# Project target.
target=Google Inc.:Google APIs x86:19
Additionally, create a sym link called "gen" pointing to target/generated-sources/r if using maven to build the android project on the command line. That way, you should be able to do "File->Import...->Existing Android Project". You get an error message, but it didn't matter in my case.
Additional hints in case you have problems with m2e-android plugin:
always check that the output folders for source dirs and resource dirs are correct.
check that source dirs are set as source dirs (you usually get a corresponding warning)
if resources from dependencies are not included in the final apk, check the filter settings for your resource dirs
you may need to "import maven project from existing sources" before importing it as android project from existing sources.
make sure dependencies are imported into the workspace and open and referenced (project props -> android -> add lib)
eclipse adt does not support aar libs, use apklib instead
It can happen if you are changing the location of files that your
eclipse project uses.
In that case you can copy the files directly to your resources folder inside the workspace instead of linking them with "import"
These simple steps put me out of this trouble -
In Eclipse, Help menu -> Check for Updates.
Select all Android related plugins.
Click Next, Accept the agreement page then proceed to install the
plugin.
Make sure your java path points to the java SDK bin directory.. make sure you have installed the latest JDK t be safe..
You can also try one of these:
Close and open the project in Eclipse
Click right on the project and choose: Android Tools -> Fix Project Properties
I beat my head against a wall for a day because of the same problem. My solution (OS X): I had a stale "java_home" definition in my profile pointing to a dead symlink, as well as old classes in /Library/Java/Extensions. I removed the definition and symlink, along with two classes in Extensions (ActiveMQ and Geronimo, FWIW) and the problem went away. Not sure which step was the actual "rectifier" but if any of those conditions apply, you might want to check them.
I faced same problem on my New Macbook Pro so I just Downloaded JDK and installed it and problem fixed.
I was experiencing the same issue - I refreshed and updated Eclipse and Android plugins and was still seeing the NPE. What worked for me was changing the order of operations.
In order:
1. update Eclipse & Android plugins
2. after the update has completed, perform the F5 Refresh in the current workspace
Make a copy of your project in Explorer/Finder. Delete the project in ADT/Eclipse. Import the project again using Eclipse. Project/Clean then build. This works for me.
I have tried every solution I found on the web and they did not work.Then I remember java version on my Mac was 1.7 and I have installed subversion version 1.6 and the problem occured after that installation.Also I have deleted eclipse and used a clean eclipse and Android sdk installation I still got the problem, then I uninstalled the JDK 7 as it is told in here http://docs.oracle.com/javase/7/docs/webnotes/install/mac/mac-jdk.html and my problem is solved.
I have several projects in my folder. Every time I start a new one I close the others. I got this error because appcompat_v7 was closed.
Right click on appcompat_v7 and select Open Project.
This solved my problem.
Solved after changing a setting in eclipse.ini. I am using OS X 10.11.4 and Eclipse Mars 4.5.2.
Go to the folder of Eclipse.app in Finder.
Right click to open a menu, and click Show Package Contents.
Go to /Contents/Eclipse.
Open eclipse.ini in your favorite text editor.
change -vm path like below:
BEFORE: /Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home/jre/bin
AFTER: /Library/Java/JavaVirtualMachines/jdk1.8.0_73.jdk/Contents/Home/jre/bin
reopen Eclipse.
enjoy :D
I have updated my SDK and ADT to the latest version, I have also update the Eclipse to Kepler the latest one after Juno.
My ADT version is 22.0. After this update when I create a new project, I'm getting error, stating R cannot be resolved to a variable. I have imported import android.R;, but it is showing as unused import stating Don't include android.R here; use a fully qualified name for each usage instead.
Same thing is happening with Mac OS also with the latest update. I have tried renaming activity_main.xml to other name, but still my R.java is not generated.
Tried all the things which are possible. Cleaned the project, build the whole workspace. Nothing helping.
I think ADT or Eclipse compatibility is having problem after the update.
I have updated my whole SDK, here is the screenshot, but same problem is there.
After updating to SDK Tools to rev. 22 for the first time, you may need to relaunch Android SDK Manager again and install a new item: Android SDK Build-tools.
After installing this, clean your projects and rebuild.
Yesterday, I made an update with sdk manager, and I had the same problem as you. I fixed the issue: I have updated another time the android sdk (with the sdk manager tool), then I check update from eclipse for install the updated ADT plugin and I rebuid my project. "Android sdk Build-tools" from Android sdk manager is now rev 17 and now it is OK. I think the issue is from adt plugin from eclipse
import android.R - remove this statement from all your classes and then do a clean your R file will be generated. if this did not work then check all your xml files for any errors and then do a clean. These 2 are the most common reasons for R file to go missing
Changes in your Build target also can effect R.java in Eclipse so
Right Click Project >> Properties >> Android >> Select Latest(usually) Android API Platform >> Click OK
Hope this is helpful.
Follow These steps...
Right Click Your Project.
Select Properties->Android Check Project Build Target and API Level.
Again come back and open Android Sdk Manager Chekc the Tools and make sure you are installed Curresponding Android SDK Build Tools.
Eg : IF you selected api level 17 in properties you should install Android SDK Build Tools 17..
Try this:
make a backup of your projects on desktop
close eclipse
delete your workspace
restart eclipse and import your projects again.
I had same problem.. I solved by doing the following:
check all xml files and drawable files if there are any CAPITAL LETTERS in file name, if you have then change it to lower case, if you are using selector xml files then check the other files you are linking in those files..all should be lower case.
Go to java files which show error and remove IMPORT R.java file from imports list.
Go to Projects>>Clean.
This should fix the problem. This is how i fixed :)
My issue was that I had android:orientation misspelled in my activity_main.xml file and I was getting this error. I fixed the spelling and problem went away! So make sure activity_main.xml doesn't have any errors in it.
Sometimes when you extract your file it miss some part so better when its extracting make sure all file are extracting properly and then run eclipse after that run a simple file and install plugin of avd
it helped in my case
if the problem persists then try closing the other projects by
right click -> close Unrelated projects !
this worked in my case
For eclipse users:
Comment the lines including R.*
Clean and build.
R.java will be generated and then uncomment the R.* and rebuild.
the best solution for r.java missing for linux...
R.java is self generated in gen folder.. so better dont edit or create manually by urself ..
-open terminal(alt + ctrl + t)
-change directory to skd->tools
-then provide executive attribute to all executable file by(sudo chmod +x filename)
-do the same for files in sdk->platform tools .. (ie sudo chmod +x filename) ..
-----every executable file sud b provided with +x attribute...
just delete gen folder all of your error will be cleared
Proven successful method, check the file (AndroidManifest.xml) and delete all comments in it, and make sure there are no errors in this file, I tried and did work with me.
My Eclipse out of the blue stopped building my Android so I removed the old version and have installed Indigo. When I try to import an Android project in I get this error:
Errors occurred during the build.
Errors running builder 'Android Resource Manager' on project 'ACCUWX_HoneyComb'.
java.lang.NullPointerException
Errors running builder 'Android Pre Compiler' on project 'ACCUWX_HoneyComb'.
java.lang.NullPointerException
Errors running builder 'Java Builder' on project 'ACCUWX_HoneyComb'.
java.lang.NullPointerException
Please help!
Try removing the .metadata folder from your workspace. This holds all your configurations, even after a new install. I think if you just delete this folder, assuming everything is in place, you should be up and running again.
The 21.0.1 version of the Eclipse ADT tools has a bug that prevents a project building if you have any files without extensions in them. This is a particular problem for users (like me) using subversion which has extenion-less files.
The solution is to install the 21.1 preview version of the ADT tools and SDK manager from Google. Clear instructions can be found here and you can read all the background add your voice to the angry mob of developers here.
This happened to me today with ADT v21.0.1-543035 and it turned out to be the .svn directories throughout the directory structure. See http://code.google.com/p/android/issues/detail?id=42051
Worked around the issue by upgrading svn client and working copy to 1.7.
For me, the source of the NullPointerException problem was a host-side Junit test project that references (and tests) code from an Android project. It didn't have a project.properties file. It's not an Android project, but for some reason the newer version of the SDK somehow expects the file there. To fix the problem, I just copied a project.properties file from an Android project to the host unit test project.
I had something similar. The problem was created by having some files without extension inside the /src folder.
In my case, a branch tool, changed the encode of the file project.properties, I changed the encode to Windows-1265 and the problem was solved.
I had the same issue and fixed it by following comment number 6 in this page:
Issue 42051: Subversion folder causes NPE in PreCompilerBuilder
Let me quote the comment:
Solved it by installing subversion support packages for eclipse:
http://gan.so/VgYT
It's still a bug but...
same problem here, I closed Eclipse, manually removed any files in folder gen for the project, started Eclipse again, and made a build.
For also me, the source of the NullPointerException problem was a host-side Junit test project that references (and tests) code from an Android project. It didn't have a project.properties file. I added it and problem got fixed.
I found the solution on this website(https://code.google.com/p/android/issues/detail?id=68755)
So basically, what we should do is :
Bring up $ADT_DIR/eclipse/Eclipse.app/Contents/MacOS/eclipse.ini in an editor. Before the -vmargs line, insert these two lines:
-vm
/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Commands/java
you can find the eclipse.ini following this
(On a Mac OS X system, you can find eclipse.ini by right-clicking (or Ctrl+click) on the Eclipse executable in Finder, choose Show Package Contents, and then locate eclipse.ini in the MacOS folder under Contents)
Upgrades did not work for me (on Linux), so I just installed IntelliJ Idea (build 123.155). Had to modify idea.sh to set JDK_HOME=/usr/lib/jvm/jdk1.7.0 (the Oracle JDK) and to select [menu] -- Run -- Run... -- Edit Configurations... -- Target Device -- USB device to make it work with the real device.