Android app with library can't find the library.apk - android

I'm trying to get the FinchVideo example from the Programming Android book to work. It uses the FinchWelcome library. I've set up FinchWelcome as a Library and in the FinchVideo application I have checked the FinchWelcome library in Properties -> Android. When I try to run FinchVideo in the emulator it complains that it cannot find FinchWelcome.apk (output below). I'm building for Android 4.0.3.
While Googling for this problem I've found that a lot of people have this problem with Android apps that use libraries. No one seems to have found a solution that works consistently, though. None of the Android books I've seen even talk about how to download libraries.
What is the proper way to handle libraries in Android applications? Is this a bug in the Eclipse ADT?
Thanks.
[FinchVideo] Installing FinchVideo.apk...
[FinchVideo] Success!
[FinchWelcome] Could not find FinchWelcome.apk!
[FinchVideo] Starting activity com.oreilly.demo.pa.finchvideo.FinchVideoActivity on device emulator-5554

Not sure if you have struggled on the same corner yet for me the solution is to add the library in the Android Properties of you project rather than as project in the Java Properties ...

I am also getting this error ( lets better call it confusing/weird message ) every now and then - my Workaround: just ignore it for now and wait for a new ADT version
And yes - imho this is a bug in ADT - Android is really nice, but ADT needs a lot of more attention for sure ..-)

I got the FitchVideo app. installed on the emulator. When I run it it crashes immediately with
D/AndroidRuntime(505): Shutting down VM
W/dalvikvm(505): threadid=1: thread exiting with uncaught exception (group=0x409c01f8)
E/AndroidRuntime(505): FATAL EXCEPTION: main
Nothing in the rest of the stack trace refers to the Fitch source (app. or lib.).
I can't tell if that is a problem with the way that ADT installed the app. and lib on the emulator or if it is some other problem.
I don't think I'm going to spend much more time with the code from the Programming Android book.

I solved the problem.
In your FinchVideo project you will need to add the reference to FinchWelcome as a jar-file library reference rather that a project library reference.
Hope this helps.

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.

Can we create multi dex support builds in Titanium android?

I have been developing an application in Titanium android.Somehow after updating titanium i started getting the 65k limit error and the solution i got is :
https://www.contentful.com/blog/2014/10/30/android-and-the-dex-64k-methods-limit/
But how to implement these in Titanium ?
this question was asked and an issue was created in 2014: https://jira.appcelerator.org/browse/TIMOB-18082
however, it is not resolved. (Under Titanium SDK 5.1.1.GA)
I met this problem today, and my solution is:
remove the unnecessary jar files!
Those jar files was referred by some java class, has huge methods ( more than 1k) but it will not be used at run time, so removing them will not cause app crash nor throw exceptions.
This is not an final solution, but kinda of trick. whatever, it works for me.

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.

Android Google API Java Client com.google.api.client.auth.oauth2.draft10

I was trying to do a simple app using the Google Tasks API. Something simple it's turning into a nightmare. Maybe it's something simple, probably it is, but I can't figure it out.
The problem: I was following the example of TasksSample.java from Google but I can't compile even after importing the libraries and dependencies required. I'm using Google API Java Client version 1.5.0.
The problem it's when I access the GoogleAccessProtectedResource class. The import is:
import com.google.api.client.googleapis.auth.oauth2.draft10.GoogleAccessProtectedResource;
I always, and I mean always, no matter what code I have get the following error:
09-26 03:14:38.372: ERROR/dalvikvm(18731): Could not find class 'com.google.api.client.googleapis.auth.oauth2.draft10.GoogleAccessProtectedResource', referenced from method com.greven.test.google.tasks.GoogleTasksTake100Activity.
09-26 03:14:38.402: ERROR/AndroidRuntime(18731): FATAL EXCEPTION: main
09-26 03:14:38.402: ERROR/AndroidRuntime(18731): java.lang.NoClassDefFoundError: com.google.api.client.googleapis.auth.oauth2.draft10.GoogleAccessProtectedResource
I really can't see where the problem is. I imported all the needed .jars... I guess
As you can see in this picture the class is obviously imported:
So what other options do I have to fix this? Use Maven? I'm clueless now. I never thought I would have a problem like this. Oh I also tested on different computers, other Google java api client (version 1.4) and same thing happened. Thanks in advance.
It seems as per your screenshot that your imported jar is imported in Eclipse, however for your Android application to work you need these jars to be dropped into a specific folder so that it is added to your APK and so the emulator and the Android devices find it.
It seems you should drop these jars in a folder named /libs at the root of your project. See this SO question: How can I use external JARs in an Android project?
The Article you are referring too uses the /assets folder but this might have changed a few Android versions ago.

how to make application with android

I am trying to create a new android apps but it says me like this
[2011-08-18 15:27:39 - jeetu] Conversion to Dalvik format failed:
Unable to execute dex: wrapper was not properly loaded first
What does it mean?
Notepad
Thats pretty good place to start
You can read developers guide. It is really good. - http://developer.android.com/guide/index.html
I love reading Pragmatic Hello Android also..
link - http://pragprog.com/book/eband3/hello-android
I'd say leave NotePad example aside and start with Eclipse and ADT. Its worth it.
A good tutorial to start :
http://developer.android.com/resources/tutorials/hello-world.html
For your error, Go to Project -> Clean, it will rebuilt workspace and fix the error

Categories

Resources