Android Studio build error or misconfigured - android

I am having trouble building with Android Studio on one of my computers. The same project was building fine and when I pushed to github and pulled from the other machine I get the following error
Argument 0 for #NotNull parameter of com/intellij/execution/configurations/GeneralCommandLine.setExePath must not be null
I tried generating a new default project and I get the same build error so it must be something with my setup.
Does anyone know what I can do to fix these issues? Or even how to completely uninstall Android Studio and start fresh? Thanks

I had same error. In my case it was caused because of modification some important configuration. I fixed the issue by executing following steps:
File -> Other Settings -> Default Project Structure
SDKs
Add new SDK (select JDK option)
Specify path to JDK (in my case it was "C:\Program Files\Java\jdk1.7.0_45")
Save changes
You can also check if you have configured path tho the Android SDK
Good luck!

Had the same problem. Had to uninstall Android Studio, delete all files related to it including install files, the .AndroidStudioPreview folder under your user directory, and those files made in your project's folder upon importing. This amounts to the idea folder and the [projectname].iml file. Now reinstall and re-import the project. You can reuse the same build.gradle. Mine's working now.

Related

New project in androidStudio makes many folders and a plugin errors. even after Reinstallation

In android studio when I create a new project, every time it makes many folders inside one another. I have every required sdk downloaded but even though it is giving an error "Install missing platform(s) and sync projects". Even after re-installation of android studio I'm facing the same issue. :(
go to File > settings > Appearance & Behavior > Android Sdk > under SDK platform, select the missing platform and apply.
If that doesn't fix it, go to the root folder of the project, remove the build folder from there.Then click on the app folder, and remove the build folder from there as well, and restart Studio.
If that also, doesnt fix the issue, update your gradle-wrapperproperties file under gradle scripts.
You can also downgrade the build tool version of your application from the gradle file. That will also fix the issue. However , it would be good practice to update it to latest.
let me know the result.

Android Studio : Unable to delete original file

I'm very new to android and I just recently cloned an Android project.
When Android Studios performs the indexing once opening the project, i get this error all the time.
this is the error I get from Android Studio.
Error:(89, 0) Failed to delete original file 'C:\Users\myname\AppData\Local\Temp\gradle_download8065263342645015068bin'
after copy to 'C:\Users\myname\.gradle\caches\modules-2\files-2.1\com.android.tools.build\gradle\1.5.0\1c3d2b23212349ffbe6479fcb04732c5cddaf98b\gradle-1.5.0.pom'
Open File
Try the next step to "Refresh" your IDE (android studio)
Choose File | Invalidate Caches/Restart.
Another possible cause is the Anti-virus. It may block Gradle or Java
There can be multiple reasons for this error but are usually linked to Rights. I solved this by following these 2 different steps at different times.
Run Android Studio as Administrator
Check if the your project folder is read-only ? If yes, remove the read-only attribute from Folder Properties.
If Invalidate Caches/Restart doesn't work, change your GRADLE BUILD TOOL to any lower Version, or different Version untill it works
For me I got the error for Gragle 2.2.3, but fixed when I changed to 2.1.3, you can try with different newer versions from here Gradle Build Tools
I was able to solve my issue by disabling the Instant Run feature of android studio.

Errors running builder 'Android Resource Manager' on ADT

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

Why my R.java cannot be generated automatically?

I just installed Eclipse on my computer. And I make a blank Android project via its wizard step by step. That means this project should work fine after it is created. But it cannot and show error of "R cannot be resolved to a variable". And I found that the gen directory is empty and it won't generate anything new in this directory even that I try to Clean and select Build Automatically option already.
I download an existing Android project from my Github and it can work. But after I run Clean, it gave the same Error information and its gen directory is empty again.
Why and how to solve it? Thanks!
Make sure that you have installed the followings in Android SDK Manager
Android SDK Tools
Android SDK Platform-tools
Android SDK Build-tools
By clicking Window-> Android SDK Manager in Eclipse
Wait a bit to let it fetch the content and you will see if they are installed or not.
It is an error of Eclipse. Create a new Project, copy all the scr and res file to new Project.
It will work fine.
1- Check for errors, if there are just comment it. The idea is to build the project et reconstruct the /gen. After that you can uncomment in good order.
2- Use Clean/refresh/build as many as you need.
3- Sometimes eclipse needs to be restarted..
4- Try to reinstall your sdk tools
5- If nothing is working you should concider reinstalling your ADT if you are using the bundle. If you are using classique eclipse reinstall android sdk retry and if it's still not working reinstall eclipse too.
hope it helps
Most of the times the error comes from wrong formatting in the XML files, which Eclipse doesn't always detect.
Make sure to go through the XMLs and check for potential errors.
If all looks good, rebuild the project.
If that fails restart Eclipse.
If that also fails, as a last resort - copy your project somewhere, reinstall Eclipse and Android SDK tools and re-import your project.

Eclipse Upgrade Not Working

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.

Categories

Resources