Android studio giving AssertionError: null error in new project creation - java

Friends
I am new in to android app development and When I am trying to setup the environment I am getting the error i am just confuse why it is happening with me I am using Ubuntu 14.04 LTS and java -version
java version "1.7.0_65"
OpenJDK Runtime Environment (IcedTea 2.5.3) (7u71-2.5.3-0ubuntu0.14.04.1)
OpenJDK 64-Bit Server VM (build 24.65-b04, mixed mode)
and when have download the android-studio-ide-135.1641136-linux.zip from here and when i am running the studio it starts well and after when I try to create a new project i am facing like this !null
java.lang.AssertionError any one can please help me in solveing the problem

I had the same issue but on Windows 7 OS. Apparently Android Studio had no idea where the Android SDK folder was located. You can set this location under File -> Project Structure -> "SDK Location" or use Ctrl+Alt+Shift+S then "SDK Location". You just have to specify the ..\Android\sdk folder location. You can also set your Java Development Kit (JDK) location as well if that is not set properly.

Remove .idea files from project it will fix your issue.

After a long research over net and R&D i found that my SDK Manager was not properly configured and was unable to download the minimum SDK but it's a bug too of an IDE so my recommendation is that if u find this kind of problem try to import an entire per-compiled project then when ever the IDE will open will open with some value. Some times in case of Linux it is some permission issue so we have to check all the permission carefully

Related

Android studio can't find ArrayList class

First of all I've been using Android studio for quite years but this has never happened before.
It seems like android studio's inner ArrayList class has vanished out of a sudden. I can't use ArrayList. It always says Can't find symbol ArrayList
I've cleaned rebuild and even invalidated caches and restarted several times but all in vain.
package dev.moutamid.testapp;
import java.util.ArrayList; //<--- this gives error
public class FragmentDashboard extends Fragment {
private ArrayList<refUser> refUsersList = new ArrayList<>(); //<--- and this line
}
My android studio is up to date. I then opened a new project and tried to use ArrayList but it was still not showing. Feels like there's nothing related to ArrayList in studio.
Yesterday I got BSOD (Blue screen of death of Windows) and today it's happening. I'm using git repository to backup my project.
What could be the solution?
I think Git has deleted ArrayList class because it already had corrupted several files before. I got luck due to the backups.
Well this is really weird. Would suggest you to try the following:
Check the jdk in android studio and check the path. If you still facing this problem then install a fresh jdk which you download online and put in the new path and try.
If this is also not working, back up all files and reinstall Android studio. Uninstall the current copy and install a fresh one.
Well since you have had a Blue screen issue, would highly recommend to do a fresh install of windows. You haven't specified which Windows version you using so I am assuming you are using Windows 10.
This link should help you out for Windows 10 : https://support.microsoft.com/en-in/help/4000735/windows-10-reinstall
And please keep taking a backup of whatever you need regularly.
I am guessing whether this is possible:
On macOS, enter java -version in the console to check the currently installed Java version. For example, I output the following:
➜ ~ java -version java version "1.8.0_212" Java(TM) SE Runtime
Environment (build 1.8.0_212-b10) Java HotSpot(TM) 64-Bit Server VM
(build 25.212-b10, mixed mode)
Check whether the JDK location in the SDK Location in Project Struture in Android Studio is correct. For example, my address is as follows:
/Applications/Android Studio.app/Contents/jre/jdk/Contents/Home
Or select app in Modules and set the Source/Target Compatibility of Properties to try?
I hope it helps you~

I am not able to install Android studio after downloading it

I have downloaded and installed JDK tool in my programx86 for windows 32.
I have set JAVA_HOME AND JDK_HOME variables. I have also set path.
I checked in the command prompt if JDK is installed and it is showing me version 1.8
Then, I downloaded Android studio.zip for windows 32.
Unzipped it, and saved it in the programx86 folder.
Now, I am suppose to run studio.bat and get the android window. But, in actual, when I click on studio.bat, I just get a flash and then nothing happens.
I tried everything. Uninstalling/installing java again and again. Setting the java path. Changing the location of Android studio.
But, it is not working for me. I am not getting the android installed. Please someone help.
I have a error file in my recent files. When I opened it, it has long text but the main msg is "EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x33773dd4, pid=7404, tid=0x00003898
#
JRE version: OpenJDK Runtime Environment (8.0_152-b02) (build 1.8.0_152-release-1024-b02)
Java VM: OpenJDK Server VM (25.152-b02 mixed mode windows-x86 )"
If this gives you a clue.
try to run .bat as Administrator. or for easy simply download Android Studio and install.
I'm a little late to the party, but I was having the same issue as you and here's what fixed it for me: setting a system variable named STUDIO_JDK to the path of your JDK installation ("C:\Program Files\Java\jdk1.8.0_181" in my case) then run "studio.bat".
Looking inside the .bat it looks like Android Studio checks STUDIO_JDK before JAVA_HOME or JDK_HOME.
i also face same issue ,but i resolved it.
Please check your C drive have proper space or not if no than make some good space.
if done that please check your android studio will run .
or
remove older version from your device and it will automatically start working .
Thanks !

How to choose Java version for Android Studio

I downloaded Android Studio latest version and installed Java 8. When I launch Android Studio I got below image.
Android studio found my Java version is 1.6 which is deprecate to run it. But I have installed java 1.8.0_101 and set the JAVA_HOME correctly. Please see below terminal output:
zhaoyi0113:Contents zhaoyi0113$ echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home
zhaoyi0113:Contents zhaoyi0113$ java -version
java version "1.8.0_101"
Java(TM) SE Runtime Environment (build 1.8.0_101-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)
I wonder how to setup java version for android studio?
EDIT1
I have tried to reboot my mac os but it still got the same error.
EDIT2
This dialog block me using android studio so there is no chance for me to click android studio menu or doing any configuration on it. When I click the update button, my browser will be open to jdk1.6 download page.
you must edit Info.plist :
to right click on the icon for the Android application Studio and choose " Show Package Contents "
Open Contents/Info.plist with a TextEdit, at the line :
<key>JVMVersion</key>
<string>1.6</string>
, changes in
<key>JVMVersion</key>
<string>1.7*,1.8+</string>
Sorry for my very bad english !
Go to File > Project Structure and pick the correct SDK and JDK location.

Android Studio Emulator - Java instance does not support 32 bit JVM

I am running android studio on a Mac os x maverick. I have installed the 64bit JDK. When I run the emulator I get the message
Error:Abnormal build process termination:
Error: This Java instance does not support a 32-bit JVM.
Please install the desired version.
in android studio.
java -version
returns
version "1.7.0_51"
Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode)
and
$JAVA_HOME
points to
/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home
So every thing seems to be fine. What could possibly be wrong?
Update:
I still had an old jdk1.6 lying around on my mac. When removing it Android Studio was asking to install Java 6 again. So apparently Android Studio needs Java 6 to compile (as confirmed by Andrew in the comment of this question). Hoping that it would install the x64 version I let it install Java 6. However I still wasn't successful afterwards. I neither could find Java 6 for Mac OS X 64 Bit. Any hints on that?
Android Studio can run on whatever it needs, but the error seems to be pointing to the SDK that the project is using. To check what your project is using, go into Project Structure > Project Settings > Project. You should now see the Project SDK. It should say something like "Android API ## Platform (java version "1.7.[current version number]"). If it doesn't say 1.7.[current version number], then it probably needs to be updated.
Here's what you can do to update it:
In Project Structure > Platform Settings > SDKs, click the "+" button to add a new SDK.
In the pop-up, go into your Android SDK folder and click "Choose"
Another pop-up will appear asking for which SDK and JDK you want to use. Choose any Android SDK and the 1.7 JDK.
Go to Project Structure > Project Settings > Project and change your Project SDK to the one you just created. You should see the name of the SDK with the new Java version that you installed.
I am not sure but I think that sometimes the error is actually stating a falsehood, and is misleading.
I agree with #Maxwell inasmuch as the problem is a mismatch between the JDK configured for the project and the JDK that IntelliJ is running under.
The specific problem I encountered was Running IntelliJ 13.1.1 with 1.6.0_65 ... x86_64 while compiling a project configured with a Java 7 x64 JDK. Reconfiguring the project to an x64 Java 6 JDK put out the fire.
I resolved this issue by doing the following:
Go to File -> Project Structure... -> Platform Settings -> SDKs
Select the SDK listed
Click on the ' - ' to remove it.
Restart Android Studio
Go to File -> Project Structure -> Platform Settings -> SDKs
Select the SDK listed
Click on the ' + ' to add it (follow path to your JDK HOME)
Restart Android Studio, and re-Build your Project.

Android Studio failed to load JVM on Mac OSX (Mavericks)

I am trying to setup Android Studio on my Mac. It is running OSX 10.9.1 Mavericks. I have installed the latest JDK (at the time of writing 1.7 update 45), and I installed Android Studio. I use Java 7 because I have some Java applications I have to run and they require 1.7. I have not installed Java 1.6, because it is ancient and old. Launching Android Studio from any launcher does literally nothing. Activity Manager never shows it running. I do not want to install Java 1.6.
I did some work and tried to run the executable via command line through the package contents, and for both executables, I get these messages:
I am unsure what I am supposed to do to fix this error. I'm not very adept on a Mac (still somewhat new to it, and its confusing to do power user stuff on this) so if anyone can help me figure it out that'd be great. I'm on the 2013 Macbook Air with plenty of resources for this to run.
Update: This also applies to Yosemite, El Capitan, and all the other versions of OSX that can run Android Studio.
Update 12/11/2014
As of Android Studio 1.0 RC3 you can follow this set of directions to make it work.
I figured it out. You have to edit the android studio's Info.plist file in the package so it uses 1.7. I don't get why Android Studio insists we install and use an outdated, vulnerable version of Java.
Full resolution: http://i.stack.imgur.com/yyYaG.png
To open the package you need to find the Android Studio.app file in the Applications folder and right click it > Show Package Contents.
Edit the plist (I think you might need to be root) and change JVMVersion from 1.6* to 1.7* (or 1.8*, or whatever JDK major version you have). I don't get why that made a difference since my original output said it was using 1.7 anyways.
This fix seems to apply to all of IntelliJ's IDEs (I've seen it on PyCharm as well), though other ones seem to support newer versions of java natively.
As answered by hasternet # Android Studio was unable to find a valid Jvm (Related to MAC OS)
For quick and dirty solution, Follow the answer by Mgamerz; open Android Studio in Finder (CTRL+Click > Show Package Contests > Contents > info.plist) and edit Key JVMOptions>JVMVersion from "1.6*" to "1.6+"
Recommended method as discovered by Antonio Jose is to edit environment variables in MacOS (messing with info.plist is not recommended)
either at program launch (opening the Studio through terminal rather than the icon)
$ export STUDIO_JDK=/Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk
$ open /Applications/Android\ Studio.app
or setting up the environment through AppleScript at every MacOS startup:
do shell script "launchctl setenv STUDIO_JDK /Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk"
do shell script "launchctl setenv STUDIO_PROPERTIES /Users/username/Library/Preferences/AndroidStudio/idea.properties"
do shell script "launchctl setenv STUDIO_VM_OPTIONS /Users/username/Library/Preferences/AndroidStudio/studio.vmoptions"
(Remember to save the script as Application. Antonio Jose managed with just the first line - AFAIK you can use .properties and .vmoptions to set up additional settings.)
Official instructions: http://tools.android.com/tech-docs/configuration/osx-jdk
(The reason why Android Studio want's to run off of JRE 1.6 is because it apparently makes the fonts look better - feel free to go through that "official" route and install JRE 1.6 # http://support.apple.com/kb/DL1572 - you can then set the JDK to 1.8 in the SDK Location settings - local.properties)
mgamerz is right - The release notes give a much better solution for rc3 and onwards - theres a idea.properties file
(or environment variable)
~/Library/Preferences/AndroidStudio/idea.properties
it also shows what environment variables you can use to set things like the jdk
export STUDIO_JDK=/Library/Java/JavaVirtualMachines/jdk1.7.0_67.jdk
ref : http://tools.android.com/recent/androidstudio1rc3_releasecandidate3released
I did below command on Mac Terminal to fix this problem, please make sure java version and path.
$java -version
java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)
$ export STUDIO_JDK=/Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk
$ open /Applications/Android\ Studio.app
Hey Friends I just Figured it out a simple way to fix this for Mac users.
Open Terminal and type this -> java -version and hit enter.
Output will be something like this:
Now check your Java Version. My Java version is 1.8
So now we need to Open Contents of our Android App.
For that right click the Android.app and then select Show Contents
Like this
Now there will be Content folder, Open that Folder and there you will find Info.plist
Open this info.plist
And you will see this.
In this expand the JVM
Here you will see the JVM version showing 1.6* but our jvm version is 1.8 (for example my jvm version is 1.8)
So we need to change this number according to our jvm version, so i changed it to version 1.8*
Then click save. And you are done.
Now you will see setup wizard running
And you are ready to start your first android programming app.
Here is the Whole Docx file for Android Studio Setup in Mac X
LINK: https://www.dropbox.com/s/9jwjebn5hgydyll/Android%20Studio%20Setup%20on%20Mac.docx?dl=0
I found that downloading an extra Java bundle from Apple fixed the issue.
If you search for this problem then I found the second link was to a blog having exactly this problem, all credit goes to him here
I know that posting links isn't an answer but as you can see from the resolution you need to make sure you have an up to date version of Java and also the Java bundle from Apple, for this reason I have also included the searches needed to get to these websites.
Here is where to download the latest version of Java
If this link is broken then searching "java latest version" return it at the top of the Google list
Here is where to download the Apple Bundle
If this link is broken then searching "Java for OS X 2014-001" returns it at the top of the Google list
For me trying to solve this problem it appears that initially it was an issue that required a work around and then Apple released an official work around download meaning that fiddling in plists is not necessary any more.

Categories