I've tried installing (and re-installing) Android Studio several times now, and each time, Studio isn't able to create a new Android project.
When I attempt to do it from the initial Android Studio window (ie. with the basic 'Create', 'Open', 'Import' etc options), I'm asked all of the questions in the wizard, but then I get a brief progress dialog, followed by nothing at all.
If I open the very incomplete project the process creates by choosing 'Open' from the list, I can then try choosing to create a new Android project from the menu.
This has exactly the same issue, however I DO get an error message in the output console this time...
java.lang.NoClassDefFoundError:
com/sun/xml/internal/bind/v2/model/annotation/AnnotationReader (wrong name:
com/sun/xml/internal/bind/v0/model/qnnotation/AnnotationReader)
NOTE: When I installed Android Studio, it installed an incompatible JDK (1.8, not 1.7). I have had to go into my default project settings to change the JDK it uses back to 1.8.
Does anyone know how I can avoid this? Is there a place I should be downloading the JXB classes? Am I missing something in my JAVA paths?
This appears to have been caused by a corrupt JRE installation.
Reinstalling JRE 8 seems to have fixed the issue and I can now create Android projects successfully in Android Studio.
Related
I know this question has been asked before, but there wasn't a satisfactory answer, and the last post was three years ago.
I am using android studio 3.6.2 in windows 10. Every time I try to compile my program I get the error
"The process cannot access the file because it is being used by another process."
Now I know what is causing the error. The R.jar file that was previously compiled cannot be deleted because android studio is locking the file.
It is in a folder \app\build\intermediates\compile_and_runtime_not_namespaced_r_class_jar\debug
Now to get around the problem I have been closing down android studio. Then deleting the R.jar, then restarting android studio and then compiling.
This process takes a good few minutes and I have to do it every time. Imagine how long it takes to write a program when you have to do this every time.
When this was asked on stack overflow previously suggestions were to Invalid caches / restart, but that is no quicker than what I did above, and only works once.
Also tried Clean Project, but that has no effect.
I have used many compilers over the years like visual studio, codeblocks etc but this kind of thing never happened before, so why is android studio so bad?
Has anyone found a solution to this problem yet?
[][]
Go to Edit Configurations check that you are not building before each launch. Remove "Build"
I also encountered the same problem in Android Studio 4.x in Windows 10. Simply using "Restart and Invalidate" does not work for me. Sometimes, deleting the build folder will work but I cannot build the project more than once. Here is my solution:
Check Java Runtime Version Used by Gradle and System Default
Having multiple daemons may cause problems as described in documentation from Gradle. To solve this problem,
Open your project in Android Studio
Find the JDK location used in your project (File > Project Structure > SDK Location > JDK Location)
Open a command prompt. Let $ANDROID_JDK be the path you found in Step 2. Type $ANDROID_JDK/bin/java.exe --version to find out the Java version.
Type java.exe --version to find out the default Java version used by the system.
Compare if the version information from Step 3 and Step 4 are the same.
Build with app Configuration
Empty Composable Activity template will create two build configurations.
You should change the build configuration to app as shown in the figure below. This solves my problem.
Proper Launching Procedure
As illustrated in Bilal Aslam's solution, we can edit the build configurations (Run > Edit Configurations). After selecting Compose Preview > Default Preview, you will see Build then Gradle-aware Make in the Before launch panel. Remove Build should be able to solve the problem. The side-effects are unclear.
I'm developing in Android Studio 3.0 when earlier today, it hit an IDE Error while I was trying to deploy code and it wasn't able to save my settings. It also said that I should reset the IDE.
After doing so, everything in the code is underlined red. The auto help suggested that I specify the JDK. After setting that, everything was fine and running again. I was able to run and compile my code and test it on a tablet.
However, when I closed and open Android Studio again, the error was back. After the fix mentioned above, I tried adding an activity to the project, and I got this:
Again, after hitting "Setup JDK" and specifying the JDK (Android API 19 Platform), the project was up and running.
I also noticed this when I opened other projects, I had to specify which JDK to use - and this is getting irritating.
Does anyone know where to setup the JDK for a project so that Android Studio won't ask me every time I open a project or add an activity? I can't find it thus far and Google hasn't been too helpful.
I updated to the latest Android Studio 3.0 version, and no matter what I do I cannot get a project to be properly recognized by Android Studio.
For one, Android Studio projects typically have the Android Studio icon instead of the typical folder icon in the file system, when browsing for a new project to open.
For two, this is what my project structure looks like - no modules, and I also cannot select "android" view instead of "project".
For three, I cannot run, build, or clean the project at all.
Sometimes when I open a project I get this error:
And sometimes that error doesn't show up at all.
Has anyone encountered this? I'm tried uninstalling Android Studio and re-installing it, installing the new 3.1 Canary 3 version, the stable version, nothing works. I've deleted and recloned every repository - I've tried many, big and small, and none work. I can compile fine from the command line though.
Many of these repos are used by other people currently using Android 3.0 stable and 3.0 Canary 3, and I'm the only one having issues, so I'm very certain it's not a repository issue. And if it is, I probably am not allowed to make whatever changes would be needed to fix this issue.
I am having a problem creating my first Android App.
I installed JDK 7u21.
I downloaded and extracted Android SDK Build: v22.0.0-675183.
I started Eclipse and created a new Android Application Project.
When I click Finish I get the following error:
Errors occurred during the build.
Errors running builder 'Android Resource Manager' on project 'Steve'.
java.lang.NullPointerException
I have search and couldn't find anyone with the same problem.
Did I install something wrong? Is something missing from the SDK? What can I do to correct this error?
In my case I switch from Android SDK 64 bits, to Android SDK 32 bits. Now it's working perfectly.
Have the same problem after updating SDK to 22. For me, it seems to be a backward compatibility fail by Android vs. Eclipse (on my side additional with Maven).
See also: Eclipse Upgrade Not Working
So not your fault. Try f.e. IntelliJ for the moment. There is also a specialised version, called Android Studio but this is not that stable as the original.
The Android guys also deliver a complete package for Eclipse + ADT-Plugin, but not sure, whether this solves the problem.
I've run into the same problem. Every new project, imported or otherwise throws that exception.
It appears to be a bug with Eclipse, and the simplest fix for me was to re-extract the ADT bundle, and replace only the eclipse directory. It'll take forever to download the SDKs if you replace the SDK directory too.
ADT bundle does not work with the Oracle Java 7 SE JDK, failing with an NPE in the Android Application Project wizard.
Installing the Eclipse Plugin
Here's a workaround that lets you keep Java 7 as the default but run ADT with Java 6 when you have both installed. 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
or any place your java is installed, for example on my computer:
/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java
Android issue tracker - answer
This works for me:
For those who experience the same problem, here is how i fixed it: After a couple of try and errors, I found out the problem was about creating an activity in the create project wizard. If you simply deselect the create activity button at the 2nd step of the wizard, it creates the project succesfully. Then you can add an activity to your project easily.
Source:
https://code.google.com/p/android/issues/detail?id=68755
eclipse is working fine with importing a project which already exist. But i am facing problem while am creating a new project in the android.
And then am trying to change the path in the properties of the project which i have created then it is showing some kind of error and screen shot of it is
Can any one help me in this.
Assuming your d: drive is an actual hard drive you have the android-sdk in, and not some DVD/CD drive you tried installing the android-sdk from.
You should click on your new android project folder, right-click and click on "close unrelated projects", then the right files will get generated correctly (re-initiate a manual rebuild if you have to).
The problem was that Eclipse was trying to rebuild all the projects you had in your workspace, a number of which already contained errors in them. Not only those other projects were clogging up your error log, but when an error is detected by the packager/builder, the building process gets stopped entirely.
Now just in case this wasn't your only problem, do Help > Check updates
After that, click on the menu Window > AVD Manager and something
and make sure that you have the latest SDKs and AVD updates already installed.
Also be aware that Pulsar is not the recommended version of Eclipse for doing Android development, although this probably wasn't what was causing your problem.