Android Studio 0.2.1 ERROR - android

I have recently updated Android Studio to version 0.2.1, only to find myself in a difficult sitation yet again.
This time the compiler says: "Abnormal build process termination:
Error: Could not find or load main class Files"!
This is what my screen looks like: https://lh3.googleusercontent.com/-srUlUCSl2iI/Ue0BqrXJgCI/AAAAAAAAARw/4UZ0IExLWRk/w958-h766-no/Untitled.jpg

I had the same issue. My solution was to right click main and and mark it as source root

Related

How to resume a stuck code analysis in Android Studio?

I recently noticed a behaviour, that the default code analysis does not finish anymore in one of my android projects, in particular in kotlin files - unfortunately without an error message. With a stuck analysis I am not able to identify errors in my code anymore and basic stuff like autocompletion does not work, which makes it unable to work.
In the top right corner of the opened file I constantly get Analyzing...
I already tried restarting Android Studio, invalidating its cache, deleting and cloning my project again, rebooting and deleting all kind of gradle and Android Studio cache files but without success.
I finally got it working again with the help of the idea.log file, which can be found via Help > Show Log in Explorer in Android Studio.
The log stated an Exception while analyzing expression at different locations in my files, caused by java.lang.IllegalStateException: #NotNull method org/jetbrains/kotlin/builtins/KotlinBuiltIns.getBuiltInClassByFqName must not return null.
Since it looked like a Kotlin related issue, I upgraded org.jetbrains.kotlin:kotlin-stdlib-jdk7 in my build.gradle from 1.4.10 to 1.5.10 and it worked instantly again. I hope the info helps anyone!
Please remove butterknife plugin in Settings-> Plugin. It is worked for me in java files.

Android Room tutorial does not build

UPDATE: Solved! (see fix at the bottom)
I'm trying to go through the Android Room tutorial but get stuck on step3. I keep getting an error when trying to update the gradle file as specified by the tutorial.
https://codelabs.developers.google.com/codelabs/android-room-with-a-view/index.html?index=..%2F..index#1
When trying to build, I get the following error:
Setting roomVersion to "2.1.0-alpha06" or just "2.1.0" generates the same type of error.
Is it only me or is there something wrong with this tutorial?
Anyone with an idea why the androidx.room:room-testing dependancy fails to build?
UPDATE:
I solved the issue by uninstalling Android Studio and re-installing it. I also needed to do a full cleanup and remove all "android studio" and "gradle" related files on my system. Maybe a bit overkill, but this is whats fixed it for me.

Getting nonsensical errors when running Android Application - "java.lang.Error: Unresolved compilation..." RuntimeException

I have a demo application that relies on a library we've developed. This was running fine until I just started randomly getting "Unresolved compilation problem" RuntimeException when I went to run the application. I had seen this before and usually a clean build fixes this, but that's no longer the case.
The errors that follow the "Unresolved compilation problem" are related to not being able to find packages it clearly show find:
AndroidRuntime(893): The import java.util cannot be resolved
AndroidRuntime(893): The import android cannot be resolved
When this happens the project will start to show up in error. Almost all the issues are around one of our Exception classes "not extending Throwable" despite the fact it extends 'Exception' (which of course extends Throwable).
I've done the following:
Ensured depend projects are properly referenced
Clean/build
Deleted the work space and brought the projects back down through source control
Deleted the ADT (with eclipse & SDK) and .android/ directories and re-installed
I feel like I'm running out of options here. Any ideas?
Update: I decided to recreate the library project and copy the source. This actually fixed the problem for a short while until I changed the 'targetSdkVersion' from 16 to 18. After this it stopped working. Changing it back to 16 did not make a difference.

How to solve the Dalvik error in adding libs to another project to make a Lite version of my Android app?

In my app, I have to have two version: Full and Lite.
I am following these tutorials:
http://bitowl.wordpress.com/2011/07/06/tutorial-how-to-make-full-and-lite-versions/
http://blog.donnfelker.com/2010/08/05/howto-android-full-and-lite-versions/
So, I build my full version, and make it a library. This full version uses some other libs, needed to some components.
Then, I create a new project and added the lib created. The problem is when I try to run my lite version, eclipse gives this error:
[2012-12-13 13:58:13 - <app> Lite] Dx
UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.IllegalArgumentException: already added: Lnet/simonvt/timepicker/R$attr;
Conversion to Dalvik format failed with error 1
The simonvt/timepicker is one of the libs that I use in my full version.
How can I fix this?
Thank you!
Do the following:
Right-click on your project and choose Build Path -> Configure Build Path,
then go to order and export section
If simonvt/timepicker has a checkmark against it, then deselect it.
I believe that the problem is that the library project is already added and you might be trying to add it again.

libgdx: android application cannot find the main game class

I have created the three projects as described in http://code.google.com/p/libgdx/wiki/ProjectSetup, and running the desktop version works, but I am getting the error below when I run the android version on the emulator. The main project is in the build path of the android project and eclipse builds everything with no errors. what am I missing?
10-31 07:06:47.023: E/dalvikvm(769): Could not find class 'com.mygame.MyGame',
referenced from method com.mygame.MyGameAndroid.onCreate
I have resolved this when I switched the Java compiler for the main project from JavaSE-1.7 to JavaSE-1.6. Do now know why this did not work with JavaSE-1.7. Would appreciate any comments on that.
EDIT: a related post: http://www.badlogicgames.com/forum/viewtopic.php?f=11&t=2314
In my case, this happened because my core Game class derived from a framework Game class. The framework class wasn't properly included; since the subclass couldn't be found, Android reported that the main class couldn't be found (since it wasn't fully known).
To solve this, I correctly added my derived framework reference, and everything worked.
In had to check the radio button in the android project properties->Java Build Path-> Order and Export-> main game project. Hope it helps anyone else.

Categories

Resources