java.lang.NoClassDefFoundError while launching the android application in libGDX - android

guys when am trying to run the android application via the desktop application this runtime error is popping up again and again. The desktop app works absolutely fine but when i try to run via the android app, it gives the noclassdeffounderror for the classes which are there in the desktop application !
its been four five hours ! what the hell is wrong with it ? what can be the possible issues with it ?
please suggestions! PS am not using ADT 17 ver. Help guys! thanks!

Right Click your Android project->Properties->Java Build Path->Order and Export Check the libraries you are using (Gdx.jar for example).

Right Click your Android project->Properties->Java Build Path->Order and Exports
Export all your jars that you are using and your desktop project with android project as shown in image and this would let your applicaion run on android.

if every thing is linked well... (using Java Build Path and Order and Export...) and still having problem running project on android check if JRE is set to 1.6.
Change the JRE from the main Java Project from 1.7 to 1.6 and try to run it on android.
Eclipse-> main-java-project--> Expand the directory--> Right click on JRE System library--> Check "Execution environment" --> select JavaES 1.6 jre6-> Click Ok

Related

All Java Files becomes red marked as error. but project build successfully

I am using android studio 1.0. I am developing a small android application. When i was editing the code in one of my java file in android studio, power cut happened.
After power came, i open the android studio and open my project, all files in the java folder marked as red indicationg error.
but the projects build successfully. when i sync with gradle.
it also done successfully. and perfectly runs in the device after launced the app in my phone.. but the red mark not disappear
even i close the project and reopen. If i create new project also, the same things happen again.
i can't understand what's happened. i also tried re install my jdk 1.7
Can anyone help me, how to fix this bug. please give exact solution. i don't like suggestions like to re install android studio
Try to Update to androidstudio 1.2
Close Android Studio
Go to C:\Users\user\\.AndroidStudio2.3\system\caches directory and delete all files.
Restart Android Studio
Done.

Running android project

I made an app and after many days I want to run it again . Because of my project was on SVN for using the app I follow this steps :
1.File--> New--> Other--> SVN--> Project From SVN ... and so no
But when I right click on the project name to run it there isn't item call "1 android application"
when I want to config it for running ,in Android tab --> Project--> Browser I can't see my project and it's list is empty .
Also I can't find AVD for running on it (I made three AVD already...)
How can I fix it... :(
please guide me.
Thanks ;)
Ensure that your AVDs are running Android version with target API. For example if your project is for API 14+, no AVD with API < 14 will be listen on Target AVD list.
In the comments you told you are not seeing any Android tab in the project properties, you should be seeing something like this:
I would think then, that you do not have the Android SDK well configured, or your project is not set to be an Android Project.
Try re installing the Android SDK. Or creating a new Android project and copy all the files in that new project.

What can I do to fix a Android SDK Null Pointer Exception error?

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

Android NDK - Eclipse can't include jni.h

So I'm using Eclipse 4.2 to build my projects which imports native functions in Java.
Everything build fine with eclipse and yesterday everything worked fine.
Today my eclipse stopped to resolve jni.h headers and others android header and shows me errors.
My project builds correctly but eclipse forbids me running application with message saying that there are errors in my application.
I have all paths to symbols in project paths and symbols c,cpp.
And it was working without errors... My only solution right now is to build project, then restart eclipse and run application...
EDIT: oh... It's funny... Now eclipse doesn't start android emulator when i click run as...
EDIT2: even when I create new project...
EDIT3: Its funny... I had to add in avd device... I don't know how it is possible but for two days I've been using it without device in avd and it was working... (I haven't change api or anything like this and I haven't touch AVD Manager)
EDIT4: Strange things happenes in eclipse... I still don't know why eclipse has problems with includes...
It's a bug in ADT 20. Refer http://code.google.com/p/android/issues/detail?id=33788
Go with Alex' adwise until ADT 21 or a patch for ADT 20 is released.
[edit] BTW: you can always simply delete errors in the Problem list ;-)
You can go to Project|Properties|C/C++ General|Code Analysis then uncheck everything in there. That will provide for running your app until you figure out the proper fix.
You can do this by choosing Properties for the project
Properties -> C/C++ General -> Preprocessor Include..-> Entries -> Setting Entries -> CDT User Setting Entries
Add -> Include Directory -> File System Path, and enter the path of the includes like:
${NDK_ROOT}\platforms\android-5\arch-arm\usr\include
Also I found that this working for me only if I checked "Contains system headers" checkbox.

IntelliJ IDEA - Android JDK doesn't work

I've just installed IntelliJ IDEA 10.0.0.2 Community edition
I've installed Android SDK ... (C:\Program Files\Android\android-sdk-windows)
I want to make a new android project, so I a create a new project, select Android Module, next , next...
Then when i need to choose the JDK, I go to the android folder, and when i try to choose it, I get this error:
The selected directory is not a valid
home for JSDK
What am I doing wrong ? what can i do to fix this ?
I Installed android SDK with all the updates
When I choose IntelliJ IDEA Plugin SDK i get:
The selected directory is not a valid
home for IntelliJ IDEA Plugin SDK
EDIT:
Still not solved...
I've already chose the SDK itself and chose android 2.2 Platform when creating the project.
Can't load the JDK files. So i won't me compile, i get this error
Cannot start compiler: the SDK is not
specified for module "blah".
Specify the SDK at Project Structure
dialog.
To develop Android applications in IntelliJ IDEA you need to set both Java SDK (JSDK) and Android SDK:
Configuring Project SDK
Java SDK
Setting Android SDK/Platform
You also need to run SDK Manager application and download Android platforms which you are going to use.
Note that you can detach all the jars from the JSDK configuration in IDEA if you are going to use it only for Android, this will help with the code completion so that only classes available in Android will be suggested by the IDE.
I also recommend to read the following tutorials:
Developing applications for Android in IntelliJ IDEA
Developing Android applications on the base of existing sources
EDIT:
Configuring project's link has been updated
JSDK is the Java SDK. On my Debian it's under /usr/lib/jvm/java-6-sun
My installation path was "C:\Users\User\AppData\Local\Android\android-sdk." That confused IDEA since it doesn't seem to be able to see hidden folders, even when typing in the full path. Bummer...I fixed it though, by setting AppData as visible.
I just wasted a whole lot of time on this problem. My work station is running IntelliJ Ultimate 11 on Windows 7 64-bit. I was setting up my first Android project. Therefore, no SDKs were configured. First I selected the JDK, which was a no-brainer (C:\ProgramFiles (x86)\Java\jdk1.6.0_30). Next comes the part where you need to specify the Android SDK. First you click the elipsis ("...") and then click "Add New". Now here's the kicker... If you look carefully at the dialog box, you'll notice that "Configure new JSDK" is highlighted by default. What you need to do is change the selection to "Android SDK". Now you can select the directory of your Android SDK and you won't get that stupid error message.
I literally wasted about a half an hour before I realized why the app kept telling me "This is not a valid SDK directory." Hopefully this will help someone else having the same problem.
Don here: I had the same trouble in Windows 64 with 11.1.2 and 64bit java. found that only by clicking on the left window could I register my Android SDK.
When you first create Android project/module, you must choose JDK, for this click "+" and select "JSDK" in menu, then select where your Java SDK is, for instance "c:\Program Files\Java\jdk1.6.0_20". Then click "Next" and in "SDK Properties" panel click "New" and select path to your Android SDK (a directory where "SDK Manager.exe" is).
Click the + symbol in the left most pane in the Select android sdk window during the creation of the project and then select the android SDK (default= c/program files/android/android-sdk)
I had a real hard time seeing how to do this on a mac, since you can't download the jdk from sun's site
#Szabolcs Berecz #Yochai On a mac, you'll need to get the source as described here:
or just jump to the download here:
Then it stored in this location:
1.6.x /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home/src.jar
If you right click in the leftmost window you can create a new Android Plugin or some such. I was just fighting with this myself. I have never used IntelliJ before and really their docs are out of date. Apparently not up to the current version.
In the JDK part you need to choose the JAVA JDK that was downloaded. (not the android)
C:\Program Files\Java\jdk1.6.0_24\
Make sure you have installed JDK 1.5 or 1.6
(1.7 is not works for some reason with Android SDK).
I had the same problem ("The selected directory is not a valid home for Android SDK"),
but after installing 1.6 JSDK - it`s work for me.
I've got the same problem with version 12 on linux, Android module does not show java sdk location and android sdk location selection fails because java sdk is not set.
I've solved by making a java project, that lets me select java sdk and android sdk (strange right?), after making such a project I can make an android project because android sdk is now configured
I've spent 30 minutes solving a foolish problem
For IntelliJ & Android on Linux.
If the "Android SDK" Menu comes up with a red 'No Android SDK' Click the browse button to the RIGHT of the drop down. - Its a different layout in Linux to Windows.
In my case, I needed to add support for android, so, I searched for android in the plugins settings.
Fixed! I needed to run IntelliJ as Administrator IDEA. Now it will approve my Android SDK directory of "C:\Program Files (x86)\Android\android-sdk"

Categories

Resources