App Engine Connected Android Project - Libraries source attachment - android

I'm new to Android and App Engine, I'm trying to create an App Engine Connected Android Project, following the steps described here:
http://code.google.com/intl/es-ES/eclipse/docs/appengine_connected_android.html
but I'm not able to go through the "Say Hello" step (Run & Debug:7) using C2DM, since it prompts a SocketException ("Address family not supported by protocol") and sometimes a RuntimeException when debugging it locally... I don't get it, because I didn't customize the project yet, but after some debugging I saw that it was complaining about some libraries (included at the project creation) not having a source attachment... The most annoying part is that it complains about ThreadPoolExecutor.class, which belongs to java.util.concurrent in the Android 2.2 JAR... Weird, but anyway I attached the library to its source and it keeps complaining about the same class ("The source attachment does not contain the source for the file ThreadPoolExecutor.class")...
It seems to crash in the Util.getRequestFactory() method, at the execution of the first line. Here it calls a method in RequestFactorySource, which belongs to the requestfactory-client library, included at the project creation but again, without a source attachment... By the way, after executing that method call, the "task" variable is valued null, is it normal?
I guess it is about a small error in the configuration or something, but I've been struggling with it for days and I already don't know what to do, so any help would be appreciated :)
EDIT: I'm attaching the logcat output, I hope this makes it easier to find the bug. After googling I found out that it is a common error in the C2DM sample project, but I didn't get any appropiate solution.
I/C2dmftwActivity( 333): onCreate
I/ActivityManager( 58): Displayed activity com.c2dmftw/.C2dmftwActivity: 1281
ms (total 1281 ms)
D/dalvikvm( 126): GC_EXPLICIT freed 997 objects / 54032 bytes in 83ms
W/dalvikvm( 333): threadid=7: thread exiting with uncaught exception (group=0x4
001d800)
E/AndroidRuntime( 333): FATAL EXCEPTION: AsyncTask #1
E/AndroidRuntime( 333): java.lang.RuntimeException: An error occured while exec
uting doInBackground()
E/AndroidRuntime( 333): at android.os.AsyncTask$3.done(AsyncTask.java:20
0)
E/AndroidRuntime( 333): at java.util.concurrent.FutureTask$Sync.innerSet
Exception(FutureTask.java:273)
E/AndroidRuntime( 333): at java.util.concurrent.FutureTask.setException(
FutureTask.java:124)
E/AndroidRuntime( 333): at java.util.concurrent.FutureTask$Sync.innerRun
(FutureTask.java:307)
E/AndroidRuntime( 333): at java.util.concurrent.FutureTask.run(FutureTas
k.java:137)
E/AndroidRuntime( 333): at java.util.concurrent.ThreadPoolExecutor.runWo
rker(ThreadPoolExecutor.java:1068)
E/AndroidRuntime( 333): at java.util.concurrent.ThreadPoolExecutor$Worke
r.run(ThreadPoolExecutor.java:561)
E/AndroidRuntime( 333): at java.lang.Thread.run(Thread.java:1096)
E/AndroidRuntime( 333): Caused by: java.lang.RuntimeException: The RequestFacto
ry ValidationTool must be run for the com.c2dmftw.client.MyRequestFactory Reques
tFactory type
E/AndroidRuntime( 333): at com.google.web.bindery.requestfactory.vm.impl
.Deobfuscator$Builder.load(Deobfuscator.java:59)
E/AndroidRuntime( 333): at com.google.web.bindery.requestfactory.vm.InPr
ocessRequestFactory.<init>(InProcessRequestFactory.java:80)
E/AndroidRuntime( 333): at com.google.web.bindery.requestfactory.vm.Requ
estFactorySource.create(RequestFactorySource.java:43)
E/AndroidRuntime( 333): at com.c2dmftw.Util.getRequestFactory(Util.java:
158)
E/AndroidRuntime( 333): at com.c2dmftw.C2dmftwActivity$2$1.doInBackgroun
d(C2dmftwActivity.java:144)
E/AndroidRuntime( 333): at com.c2dmftw.C2dmftwActivity$2$1.doInBackgroun
d(C2dmftwActivity.java:1)
E/AndroidRuntime( 333): at android.os.AsyncTask$2.call(AsyncTask.java:18
5)
E/AndroidRuntime( 333): at java.util.concurrent.FutureTask$Sync.innerRun
(FutureTask.java:305)
E/AndroidRuntime( 333): ... 4 more
W/ActivityManager( 58): Force finishing activity com.c2dmftw/.C2dmftwActivit
y
W/GTalkService( 170): [GTalkConnection.13] doConnect: caught XMPPError connecti
ng to mtalk.google.com:5228.: (502)
W/GTalkService( 170): -- caused by: java.net.SocketException: The operation t
imed out

I think I had the same problem. The Validation library was missing and after adding it manually it worked.
To add it or to check if it's included do:
Right click on your project > Properties > Java Build Path > Libraries Tab > Add External JARs
Then browser to your GWT installation folder. If you installed it with eclipse it's in eclipse/plugins/com.google.gwt.eclipse.sdkbundle_/gwt-/validation-api-1.0.0.GA.jar
Clean and build your workspace and try it again.
This could happen on the client GWT side too. If that happens you have to do the same but use your GAE project and add the same jar

This is the problem
Caused by: java.lang.RuntimeException: The RequestFacto
ry ValidationTool must be run for the com.c2dmftw.client.MyRequestFactory Reques
tFactory type
If you are using GWT 2.4+, you will have to run a validation tool. You can configure Eclipse to do this for you, here is how:
http://code.google.com/p/google-web-toolkit/wiki/RequestFactoryInterfaceValidation

Related

Android App crashes after integrating Google Play Services for AdMob using Pygame Subset for Android

i'm using Pgs4a (Pygame Subset for Android) to build my app. This works fine, until:
Recently i integrated the Google Play Services into my app for using Admob, but unfortunately my app crashes as soon as i launch it.
I already asked in Google Group for Admob, which recommended me to ask for help here. I also saw some posts here, but didn't solve my problem.
Here is, what i think, is the important part of my logcat.log
E/dalvikvm( 7969): dlopen("/data/app-lib/com.myapp-1/libsdl_mixer.so") failed: dlopen failed: cannot locate symbol "__gnu_thumb1_case_sqi" referenced by "libsdl_mixer.so"...
W/dalvikvm( 7969): threadid=15: thread exiting with uncaught exception (group=0x417f5da0)
E/AndroidRuntime( 7969): FATAL EXCEPTION: Thread-817
E/AndroidRuntime( 7969): Process: com.myapp, PID: 7969
E/AndroidRuntime( 7969): java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "__gnu_thumb1_case_sqi" referenced by "libsdl_mixer.so"...
E/AndroidRuntime( 7969): at java.lang.Runtime.loadLibrary(Runtime.java:365)
E/AndroidRuntime( 7969): at java.lang.System.loadLibrary(System.java:526)
E/AndroidRuntime( 7969): at org.renpy.android.PythonActivity.run(PythonActivity.java:280)
E/AndroidRuntime( 7969): at java.lang.Thread.run(Thread.java:841)
W/ActivityManager( 704): Force finishing activity com.myapp/org.renpy.android.PythonActivity
The libsdl_mixer.so is inside my pygs4a/libs/armeabi folder, if that helps.
Have you any ideas what i'm doing wrong?
I work on Windows 7 by the way.
Any help is much appreciated :)

Android Studio 0.8.2: project using an sdk add-on which provides a jar library

I am trying to build a SDK add-on so developpers can use our library. I started by using this sample (a jar library add-on containing a system service):
https://github.com/gibsson/basic_sdk_addon
https://github.com/gibsson/BasicService
https://github.com/gibsson/BasicClient
I have followed the instructions from BasicService and BasicClient github pages and successfully created a working image by building both applications with the AOSP (for Android 4.3).
I built the two packages by adding the following to the device.mk file:
PRODUCT_PACKAGES += \
com.gibsson.basic.service.lib \
com.gibsson.basic.service.lib.xml \
BasicServiceApp \
BasicClient
This way, everything was build in the image and working.
End of introduction
I removed the BasicClient package from the build process and I am trying to bring this client in Android Studio, with the SDK, as would Android developpers do (they don't have access to the AOSP)
The basic_sdk_addon was successfuly created by following the instructions and using this command:
AOSP$ make PRODUCT-basic_sdk_addon-sdk_addon
I installed the Add-on in Android Studio using a User-defined repo. In the BasicClient project, I had to manually add the .jar file to the app/libs folder and click "Add as library" in order to compile BasicClient properly.
When trying to run/debug the BasicClient from AndroidStudio, I get the following error (from logcat, it's more detailed):
I/ActivityManager( 2544): Start proc com.gibsson.basic.client for activity com.gibsson.basic.client/.BasicActivity: pid=3311 uid=10044 gids={50044, 1015, 1028}
W/dalvikvm( 3311): Class resolved by unexpected DEX: Lcom/gibsson/basic/client/BasicActivity;(0x4213e238):0x40030000 ref [Lcom/gibsson/basic/service/lib/BasicManager;] Lcom/gibsson/basic/service/lib/BasicManager;(0x4213e238):0x4001d000
W/dalvikvm( 3311): (Lcom/gibsson/basic/client/BasicActivity; had used a different Lcom/gibsson/basic/service/lib/BasicManager; during pre-verification)
D/AndroidRuntime( 3311): Shutting down VM
W/dalvikvm( 3311): threadid=1: thread exiting with uncaught exception (group=0x41891700)
E/AndroidRuntime( 3311): FATAL EXCEPTION: main
E/AndroidRuntime( 3311): java.lang.IllegalAccessError: Class ref in pre-verified class resolved to unexpected implementation
E/AndroidRuntime( 3311): at com.gibsson.basic.client.BasicActivity.<init>(BasicActivity.java:18)
E/AndroidRuntime( 3311): at java.lang.Class.newInstanceImpl(Native Method)
E/AndroidRuntime( 3311): at java.lang.Class.newInstance(Class.java:1130)
E/AndroidRuntime( 3311): at android.app.Instrumentation.newActivity(Instrumentation.java:1061)
E/AndroidRuntime( 3311): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2128)
E/AndroidRuntime( 3311): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
E/AndroidRuntime( 3311): at android.app.ActivityThread.access$600(ActivityThread.java:141)
E/AndroidRuntime( 3311): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
E/AndroidRuntime( 3311): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 3311): at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime( 3311): at android.app.ActivityThread.main(ActivityThread.java:5103)
E/AndroidRuntime( 3311): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 3311): at java.lang.reflect.Method.invoke(Method.java:525)
E/AndroidRuntime( 3311): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
E/AndroidRuntime( 3311): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
E/AndroidRuntime( 3311): at dalvik.system.NativeStart.main(Native Method)
W/ActivityManager( 2544): Force finishing activity com.gibsson.basic.client/.BasicActivity
I understand that there is a mismatch between the BasicManager dex file found and what it expects. I verified if the tools used where the same version between the AOSP and Android Studio: both use the same JDK (1.6.0.45) and the same compile version (18).
Got it working: it seems that importing the BasicService Eclipse project modified the Dependencies scope drop down menu (in Project Structure). I can now choose Provided instead of Compile, and the application works perfectly.
When creating a new project from scratch, I only had the following choices: Compile, Runtime.
So I've looked at the differences between the two projects and the build.gradle file was the only one that was changed: compile was replaced by provided.
dependencies {
provided files('libs/com.orthogone.canvas.service.lib.jar')
}
There seems to be a bug in the UI, as the Dependencies Dialog doesn't provide this choice even with the build.gradle modification.
Another important note: the AndroidManifest.xml must contain the <uses-library> information in the <appliation> section:
<uses-library
android:name="com.gibsson.basic.service.lib"
android:required="true" />

GenyMotion 4.3 Image fails to launch application

I have updated to Genymotion 2.0 and downloaded/deployed the new 4.3 images (Galaxy Nexus and 10.1 Tablet) upon installing the appropriate GApps package get a devastating error upon launching a development app with the following stack trace making the device restart.
I/Process ( 3117): Sending signal. PID: 3117 SIG: 9
E/AndroidRuntime( 3117): *** FATAL EXCEPTION IN SYSTEM PROCESS: android.server.ServerThread
E/AndroidRuntime( 3117): java.lang.IllegalArgumentException: provider doesn't exisit: null
E/AndroidRuntime( 3117): at com.android.server.LocationManagerService.requestLocationUpdatesLocked(LocationManagerService.java:1323)
E/AndroidRuntime( 3117): at com.android.server.LocationManagerService.requestLocationUpdates(LocationManagerService.java:1302)
E/AndroidRuntime( 3117): at android.location.LocationManager.requestLocationUpdates(LocationManager.java:836)
E/AndroidRuntime( 3117): at android.location.LocationManager.requestLocationUpdates(LocationManager.java:461)
E/AndroidRuntime( 3117): at com.android.location.fused.FusionEngine.enableProvider(FusionEngine.java:138)
E/AndroidRuntime( 3117): at com.android.location.fused.FusionEngine.updateRequirements(FusionEngine.java:191)
E/AndroidRuntime( 3117): at com.android.location.fused.FusionEngine.setRequest(FusionEngine.java:114)
E/AndroidRuntime( 3117): at com.android.location.fused.FusedLocationProvider$2.handleMessage(FusedLocationProvider.java:98)
E/AndroidRuntime( 3117): at androi
For what I know the last update to Genymotion removed the support for google apps and google-play-service from it's images because of some disagreement with Google, you can read more about it here:
https://plus.google.com/+GenymotionEmulator/posts/jNF8Kwu5p1c
So from now on, you can't run Google Maps API V2 applications and use other features of the google-play-service like the LocationManager you are trying to use.
UPDATE:
As mentioned in the comments you could install the GApps package manually using the following guide:
http://blog.zeezonline.com/2013/11/install-google-play-on-genymotion-2-0/

No JNI_OnLoad found skipping init > Application shutdown

Folks,
I am working on an android application where I need a third party .so library. I built
this third party library (with ndk-build) as per their instructions and was then looking
to include this .so in to my Android project.
Therefore I followed the steps described in docs/PREBUILTS.html and successfully build the
new .so in the jni/prebuilt directory. Now I tried leveraging the .so facilities by using it in a simple test android app. So what i do is :
static {
Log.i("load so > ","load so");
System.loadLibrary("xyz");
}
/* The native functions */
private static native int openFile(String filename);
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
try{
String path = getPathForDownloadDirectoryFile();
Log.i("file path> ", path);
int num= openFile(path);
}catch(Exception e){
Log.e(">", "could not open the file");
}
}
Now when I run my app I get a debug message saying :
No JNI_OnLoad found in /data/data/com.example.myfirstapp/lib/xyz.so 0x411e6738, skipping init
and then the application shuts down.
For More Info, Here is the error log :
No JNI_OnLoad found in /data/data/com.example.mysecondapp/lib/xyz.so 0x411e67a0, skipping init
W/dalvikvm( 570): No implementation found for native Lcom/example/mysecondapp/MainActivity;.openFile:(Ljava/lang/String;)I
D/AndroidRuntime( 570): Shutting down VM
W/dalvikvm( 570): threadid=1: thread exiting with uncaught exception (group=0x40a13300)
E/AndroidRuntime( 570): FATAL EXCEPTION: main
E/AndroidRuntime( 570): java.lang.UnsatisfiedLinkError: Native method not found: com.example.mysecondapp.MainActivity.openFile:(Ljava/lang/String;)I
E/AndroidRuntime( 570): at com.example.mysecondapp.MainActivity.openFile(Native Method)
E/AndroidRuntime( 570): at com.example.mysecondapp.MainActivity.onCreate(MainActivity.java:31)
E/AndroidRuntime( 570): at android.app.Activity.performCreate(Activity.java:5008)
E/AndroidRuntime( 570): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
E/AndroidRuntime( 570): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
E/AndroidRuntime( 570): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
E/AndroidRuntime( 570): at android.app.ActivityThread.access$600(ActivityThread.java:130)
E/AndroidRuntime( 570): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
E/AndroidRuntime( 570): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 570): at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime( 570): at android.app.ActivityThread.main(ActivityThread.java:4745)
E/AndroidRuntime( 570): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 570): at java.lang.reflect.Method.invoke(Method.java:511)
E/AndroidRuntime( 570): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
E/AndroidRuntime( 570): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
E/AndroidRuntime( 570): at dalvik.system.NativeStart.main(Native Method)
W/ActivityManager( 146): Force finishing activity com.example.mysecondapp/.MainActivity
As I could see that native implementation for the openFile() method was not found but the same xyz.so lib worked pretty neat with the original sample app from the third party. I am pretty much a starter with Android-ndk world.
Java-Android-NDK Ninjas ..any guess on what I might be missing ?
I'll highly appreciate any help here :)
As guycole said "No JNI_OnLoad" is just a warning , your problem lies elsewhere .
As you mentioned you successfully compiled your "so" file , the problem may lie in your function signatures inside your c/C ++ code it should be something like this
JNIEXPORT jint JNICALL Java_com_your_package_class_method(JNIEnv *d, jobject e, jstring f)
{
//some action
}
The function signatures comes from the header file which is generated using javah tool.You need to generate header file and use the function signature with your package name. For different package and class names the header file and corresponding function signature will change .
worked pretty neat with the original sample app from the third party
This might be the reason its running on the sample app and not on your app.
refer: https://thenewcircle.com/s/post/49/using_ndk_to_call_c_code_from_android_apps
The "No JNI_OnLoad" message is just a warning. JNI_OnLoad is an optional initialization hook.
I guess your problem is inside the openFile() method. Try commenting out the call from Java and see how far you get.
I have a blog post about JNI and some sample code at http://guycole.blogspot.com/2012/03/yet-another-android-ndk-blog-posting.html - perhaps you will find it useful.
Good luck.
It also comes with this log
??-?? ??:??:??.???: INFO/(): java.lang.UnsatisfiedLinkError: Couldn't load *: findLibrary returned null
right??
I think it's the problem of android.mk files.
1:try to swith to armabi v7.
2:load funciton will call open(). check permission of the so.
As mentioned in the previous answers, No JNI_OnLoad is only a warning.
I had got similar problem, I figured the problem is because of file operations.
My app was not having external storage write permission.After adding the below code in
manifest it was working fine

Android UnsatisfiedLinkError: Issue loading a shared library

I am compiling some Java code, putting it into a .JAR and then running dx --dex on it. I am pushing my file to an Android device through adb but I am having problem linking my shared library at runtime.
In HostConnection.java, I have the following code to load my library:
static {
System.loadLibrary("hostConnection");
}
I am loading the application this way:
adb shell
su
export CLASSPATH=/data/local/device.jar
export LD_LIBRARY_PATH=/data/local/libhostConnection.so
exec app_process /system/bin com.device.client.Main
I am unfortunately getting the following error:
D/dalvikvm( 1616): DexOpt: load 482ms, verify 84ms, opt 10ms
D/dalvikvm( 1608): DexOpt: --- END 'device.jar' (success) ---
D/dalvikvm( 1608): DEX prep '/data/local/device.jar': unzip in 1715ms, rewrite 1287ms
W/dalvikvm( 1608): Exception Ljava/lang/UnsatisfiedLinkError; thrown during Lcom/device/client/HostConnection;.<clinit>
D/AndroidRuntime( 1608): Shutting down VM
W/dalvikvm( 1608): threadid=1: thread exiting with uncaught exception (group=0x4001d830)
I/Process ( 1608): Sending signal. PID: 1608 SIG: 9
E/AndroidRuntime( 1608): *** FATAL EXCEPTION IN SYSTEM PROCESS: main
E/AndroidRuntime( 1608): java.lang.ExceptionInInitializerError
E/AndroidRuntime( 1608): at com.device.client.Main.<init>(Main.java:27)
E/AndroidRuntime( 1608): at com.device.client.Main.main(Main.java:21)
E/AndroidRuntime( 1608): at com.android.internal.os.RuntimeInit.finishInit(Native Method)
E/AndroidRuntime( 1608): at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:235)
E/AndroidRuntime( 1608): at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime( 1608): Caused by: java.lang.UnsatisfiedLinkError: Library hostConnection not found
E/AndroidRuntime( 1608): at java.lang.Runtime.loadLibrary(Runtime.java:461)
E/AndroidRuntime( 1608): at java.lang.System.loadLibrary(System.java:557)
E/AndroidRuntime( 1620): at com.device.client.HostConnection.<clinit>(HostConnection.java:25)
The line 25 in HostConnection.java is indeed System.loadLibrary("hostConnection").
My library is called libhostConnection.so and my .jar is called device.jar. They are both stored in /data/local. I have tried moving the shared library to /system/lib but the shell does not let me copy the file (read-only).
I am not sure what I am doing wrong, but I believe it cannot find the shared library for linking when running the application. I am not sure if I am using the wrong variable in export, or if I am supposed to do something else.
Could anyone please help me? It would be much appreciated.
Thank you very much!
And why don't you just try putting your library into lib/armeabi(-v7a) directory in your eclipse project? I believe it's the recomended way of linking shared library.
I figured it out. The variable is correct, but the path should be just the folder, not the .so file for some reason:
export LD_LIBRARY_PATH=/data/local
This actually works.
Thank you.

Categories

Resources