Google Drive SDK application to upload file - android

I am trying to use the Google Drive SDK to upload files, but I am getting a pop up saying unfortunately your application has stopped. This is due to a NoClassDefFoundError. I also made sure to include the play services jar and check it in the order and export tab as well.
This is the excpetion:
E/AndroidRuntime( 4906): java.lang.NoClassDefFoundError: com.google.android.gms.common.AccountPicker
E/AndroidRuntime( 4906): at com.google.api.client.googleapis.extensions.android.gms.auth.GoogleAccountCredential.
newChooseAccountIntent(GoogleAccountCredential.java:253)
E/AndroidRuntime( 4906): at com.example.informationretreival.MainActivity.onCreate(MainActivity.java:42)
E/AndroidRuntime( 4906): at android.app.Activity.performCreate(Activity.java:5104)
E/AndroidRuntime( 4906): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
E/AndroidRuntime( 4906): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2147)
E/AndroidRuntime( 4906): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233)
E/AndroidRuntime( 4906): at android.app.ActivityThread.access$600(ActivityThread.java:144)
E/AndroidRuntime( 4906): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1237)
E/AndroidRuntime( 4906): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 4906): at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime( 4906): at android.app.ActivityThread.main(ActivityThread.java:5074)
E/AndroidRuntime( 4906): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 4906): at java.lang.reflect.Method.invoke(Method.java:511)
E/AndroidRuntime( 4906): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
E/AndroidRuntime( 4906): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
E/AndroidRuntime( 4906): at dalvik.system.NativeStart.main(Native Method)
W/ActivityManager( 771): Force finishing activity com.example.informationretreival/.MainActivity
I am following the quickstart on the developer website I have literally just copied the code. I would expect the quickstart example to work. Someone please point me in the right direction.

In your Android application configuration page, select Google APIs (Google Inc.) (API 17) for Compile with. Also, it would work more stable on real phone than virtual device since virtual device doesn't have play store.

Related

React Native App Crashes on Launch in Android (API 19)

Description
I have created a project with react-native-cli
When I launch the app using the command "react-native run-android" on Devices and Emulators with Android API level 21+ App is launching.
But for devices less than API 21, the app crashing on launch.
I have specified in android Gradle minSdk version to 16.
I viewed the stack trace using "adb logcat" the crash was due to OkHttp3 that is used internally in Facebook Flipper, which is expecting API 21+.
I haven't used any OkHttp3 Dependency explicitly in my app
React Native version:
6.14.4
Steps To Reproduce
Create a project using react-native CLI not Expo CLI
Navigate to the project folder
Connect a device or an emulator with API less than 21
run command "react-native run-android" to run the app on the connected device
Expected Results
The app should launch without any crash.
Android Logs
E/AndroidRuntime( 3745): java.lang.RuntimeException: Unable to create application com.infifive.MainApplication: java.lang.RuntimeException: Requested enabled DevSupportManager, but DevSupportManagerImpl class was not found or could not be created
E/AndroidRuntime( 3745): at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4347)
E/AndroidRuntime( 3745): at android.app.ActivityThread.access$1500(ActivityThread.java:135)
E/AndroidRuntime( 3745): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
E/AndroidRuntime( 3745): at android.os.Handler.dispatchMessage(Handler.java:102)
E/AndroidRuntime( 3745): at android.os.Looper.loop(Looper.java:136)
E/AndroidRuntime( 3745): at android.app.ActivityThread.main(ActivityThread.java:5017)
E/AndroidRuntime( 3745): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 3745): at java.lang.reflect.Method.invoke(Method.java:515)
E/AndroidRuntime( 3745): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
E/AndroidRuntime( 3745): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
E/AndroidRuntime( 3745): at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime( 3745): Caused by: java.lang.RuntimeException: Requested enabled DevSupportManager, but DevSupportManagerImpl class was not found or could not be created
E/AndroidRuntime( 3745): at com.facebook.react.devsupport.DevSupportManagerFactory.create(DevSupportManagerFactory.java:90)
E/AndroidRuntime( 3745): at com.facebook.react.ReactInstanceManager.<init>(ReactInstanceManager.java:238)
E/AndroidRuntime( 3745): at com.facebook.react.ReactInstanceManagerBuilder.build(ReactInstanceManagerBuilder.java:281)
E/AndroidRuntime( 3745): at com.facebook.react.ReactNativeHost.createReactInstanceManager(ReactNativeHost.java:87)
E/AndroidRuntime( 3745): at com.facebook.react.ReactNativeHost.getReactInstanceManager(ReactNativeHost.java:39)
E/AndroidRuntime( 3745): at com.infifive.MainApplication.onCreate(MainApplication.java:47)
E/AndroidRuntime( 3745): at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1007)
E/AndroidRuntime( 3745): at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4344)
E/AndroidRuntime( 3745): ... 10 more
E/AndroidRuntime( 3745): Caused by: java.lang.reflect.InvocationTargetException
E/AndroidRuntime( 3745): at java.lang.reflect.Constructor.constructNative(Native Method)
E/AndroidRuntime( 3745): at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
E/AndroidRuntime( 3745): at com.facebook.react.devsupport.DevSupportManagerFactory.create(DevSupportManagerFactory.java:80)
E/AndroidRuntime( 3745): ... 17 more
E/AndroidRuntime( 3745): Caused by: java.lang.ExceptionInInitializerError
E/AndroidRuntime( 3745): at okhttp3.OkHttpClient.newSslSocketFactory(OkHttpClient.java:263)
E/AndroidRuntime( 3745): at okhttp3.OkHttpClient.<init>(OkHttpClient.java:229)
E/AndroidRuntime( 3745): at okhttp3.OkHttpClient$Builder.build(OkHttpClient.java:1015)
E/AndroidRuntime( 3745): at com.facebook.react.devsupport.DevServerHelper.<init>(DevServerHelper.java:132)
E/AndroidRuntime( 3745): at com.facebook.react.devsupport.DevSupportManagerImpl.<init>(DevSupportManagerImpl.java:183)
E/AndroidRuntime( 3745): ... 20 more
E/AndroidRuntime( 3745): Caused by: java.lang.IllegalStateException: Expected Android API level 21+ but was 19
E/AndroidRuntime( 3745): at okhttp3.internal.platform.AndroidPlatform.buildIfSupported(AndroidPlatform.java:238)
E/AndroidRuntime( 3745): at okhttp3.internal.platform.Platform.findPlatform(Platform.java:202)
E/AndroidRuntime( 3745): at okhttp3.internal.platform.Platform.<clinit>(Platform.java:79)`
The only way I found to fix it is by commenting out all the code associated with flipper
GH thread here
This happens because of an internal check in the library called "okhttp" where the newer versions are supporting only API 21 and above. If possible, reduce the okhttp version, or anything related to it such as Glide or Retrofit etc. That will solve your problem.

app still running after disable

I’ve installed an app I’ve written as a system app that after receiving ACTION_BOOT_COMPLETED it runs a service.
The app works just fine, however, I would like to disable it (and not remove it completely).
So I wrote on the command line “adb shell pm disable [The package name]” and after reboot, even though I do not see my app on the menu anymore, I still get a message “Unfortunately [myApp] has stopped”.
Logcat:
FATAL EXCEPTION: main
E/AndroidRuntime( 1356): java.lang.RuntimeException: Unable to instantiate service [package name] : java.lang.ClassNotFoundException: Didn't find class "[packagename.classThatStartsTheService]" on path: /system/app/app.apk
E/AndroidRuntime( 1356): at android.app.ActivityThread.handleCreateService(ActivityThread.java:2516)
E/AndroidRuntime( 1356): at android.app.ActivityThread.access$1600(ActivityThread.java:144)
E/AndroidRuntime( 1356): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1319)
E/AndroidRuntime( 1356): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 1356): at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime( 1356): at android.app.ActivityThread.main(ActivityThread.java:5074)
E/AndroidRuntime( 1356): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 1356): at java.lang.reflect.Method.invoke(Method.java:511)
E/AndroidRuntime( 1356): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
E/AndroidRuntime( 1356): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
E/AndroidRuntime( 1356): at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime( 1356): Caused by: java.lang.ClassNotFoundException: Didn't find class "[packagename.class that starts the service]" on path: /system/app/app.apk
E/AndroidRuntime( 1356): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:65)
E/AndroidRuntime( 1356): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
E/AndroidRuntime( 1356): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
E/AndroidRuntime( 1356): at android.app.ActivityThread.handleCreateService(ActivityThread.java:2513)
E/AndroidRuntime( 1356): ... 10 more
Does that mean the boot_completed is still recognized by my app but because it is disabled it cannot run? Or is it something else?
Thanks in advance!
So, apparently I had another app that had the option to activate my app (only when choosing so and not by default), so after reboot, it couldn’t find it’s apk as it was disabled. So I disabled the second app as well.

Android + Corona SDK: Couldn't Load Lua

Yes, I know this question is similar to this, but it never got answered and I don't like resurrecting old threads (from July '13).
I just began testing my game on a real device (yay!), and though it works perfectly on the Corona Simulator, every time I open it on the actual device and now the emulator, I get "Sorry! The application SampleApp (process com.foo.bar.SampleApp) has stopped unexpectedly. Please try again." I opened adb logcat and find that I'm getting this error:
I/ActivityThread( 1264): Pub com.foo.bar.SampleApp.files: com.ansca.corona.storage.FileContentProvider
W/dalvikvm( 1264): Exception Ljava/lang/UnsatisfiedLinkError; thrown while initializing Lcom/ansca/corona/JavaToNativeShim;
W/dalvikvm( 1264): Exception Ljava/lang/ExceptionInInitializerError; thrown while initializing Lcom/ansca/corona/CoronaEnvironment;
D/AndroidRuntime( 1264): Shutting down VM
W/dalvikvm( 1264): threadid=1: thread exiting with uncaught exception (group=0x40020560)
E/AndroidRuntime( 1264): FATAL EXCEPTION: main
E/AndroidRuntime( 1264): java.lang.ExceptionInInitializerError
E/AndroidRuntime( 1264): at com.ansca.corona.CoronaView.deleteTempDirectory(CoronaView.java:141)
E/AndroidRuntime( 1264): at com.ansca.corona.CoronaActivity.onCreate(CoronaActivity.java:101)
E/AndroidRuntime( 1264): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
E/AndroidRuntime( 1264): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1618)
E/AndroidRuntime( 1264): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1670)
E/AndroidRuntime( 1264): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
E/AndroidRuntime( 1264): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
E/AndroidRuntime( 1264): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 1264): at android.os.Looper.loop(Looper.java:130)
E/AndroidRuntime( 1264): at android.app.ActivityThread.main(ActivityThread.java:3695)
E/AndroidRuntime( 1264): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 1264): at java.lang.reflect.Method.invoke(Method.java:507)
E/AndroidRuntime( 1264): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:842)
E/AndroidRuntime( 1264): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
E/AndroidRuntime( 1264): at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime( 1264): Caused by: java.lang.ExceptionInInitializerError
E/AndroidRuntime( 1264): at com.ansca.corona.CoronaEnvironment.setLuaErrorHandler(CoronaEnvironment.java:379)
E/AndroidRuntime( 1264): at com.ansca.corona.CoronaEnvironment.<clinit>(CoronaEnvironment.java:41)
E/AndroidRuntime( 1264): ... 15 more
E/AndroidRuntime( 1264): Caused by: java.lang.UnsatisfiedLinkError: Couldn't load lua: findLibrary returned null
E/AndroidRuntime( 1264): at java.lang.Runtime.loadLibrary(Runtime.java:429)
E/AndroidRuntime( 1264): at java.lang.System.loadLibrary(System.java:554)
E/AndroidRuntime( 1264): at com.ansca.corona.JavaToNativeShim.<clinit>(JavaToNativeShim.java:118)
E/AndroidRuntime( 1264): ... 17 more
W/ActivityManager( 146): Force finishing activity com.foo.bar.SampleApp/com.ansca.corona.CoronaActivity
Of course, the real process name isn't com.foo.bar.SampleApp, but it's the same thing.
I have an old Android, so that may be the issue, but I sure hope not. I'm on a Huawei-U8652, Android version 2.3.5. I also built a Corona sample code app, and it did the same thing with the same error.
The error is that Lua can't be found, that's pretty extreme. Works from Corona Sim, but not on real device, or in Eclipse-based emulator. Until you can get it to work on the real device, there is no point in using the emulator, it's just too much of an unknown wrt Corona. Try this:
verify examples that come with Corona work on your device
if they do, start adding parts of your main.lua in one of those examples; maybe at some point the error will happen again, allowing you to identify a specific lib call that corrupts memory and sends everything wally
start adding other parts of your app (if you import modules during startup), until you see the error again

App crashed when installed from Market but not if the Apk is installed manually.

My App works fine if I just install it manually by moving the apk onto the phone and installing it, however when I put it on the Market it crashes on the first Activity, this is the logcat.
E/AndroidRuntime( 999): FATAL EXCEPTION: main
E/AndroidRuntime( 999): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.mbwasi.funapp/com.mbwasi.funapp.Splash}: java.lang.ClassNotFoundException: com.mbwasi.funapp.Splash in loader dalvik.system.PathClassLoader[/data/app/com.mbwasi.funapp-1.apk]
E/AndroidRuntime( 999): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
E/AndroidRuntime( 999): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2721)
E/AndroidRuntime( 999): at android.app.ActivityThread.access$2300(ActivityThread.java:132)
E/AndroidRuntime( 999): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2071)
E/AndroidRuntime( 999): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 999): at android.os.Looper.loop(Looper.java:123)
E/AndroidRuntime( 999): at android.app.ActivityThread.main(ActivityThread.java:4669)
E/AndroidRuntime( 999): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 999): at java.lang.reflect.Method.invoke(Method.java:521)
E/AndroidRuntime( 999): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:876)
E/AndroidRuntime( 999): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:634)
E/AndroidRuntime( 999): at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime( 999): Caused by: java.lang.ClassNotFoundException: com.mbwasi.funapp.Splash in loader dalvik.system.PathClassLoader[/data/app/com.mbwasi.funapp-1.apk]
E/AndroidRuntime( 999): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)
E/AndroidRuntime( 999): at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
E/AndroidRuntime( 999): at java.lang.ClassLoader.loadClass(ClassLoader.java:532)
E/AndroidRuntime( 999): at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
E/AndroidRuntime( 999): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2619)
E/AndroidRuntime( 999): ... 11 more
What could be happening here? I also notice in the log that the apk name has a -1 at the end too,
com.mbwasi.funapp-1.apk
where would this be coming from?
Is this on the same phone? Are you sure you are uploading the exact same APK? ClassNotFoundException could mean that some class your Splash activity is using is not found, you might be missing some library.
Well I left it overnight, refreshed the market page for my App and now it not only shows as compatible with all my devices but also works when installed. So it was a Market issue. There was a tip in the other thread to unpublish and publish and I did that, no idea if it actually did anything though.

MonoDevelop default M4A application "has stopped unexpectedly"

When I try running the default "Mono for Android Application", I get an error that the application has stopped unexpectedly.
After, (sometimes) I would get an exception in MonoDevelop: System.IO.IOException: DWP Handshake failed.
I'm not sure what could be wrong - I haven't made any changes to the application. Any help would be greatly appreciated - I've been trying to get this running all day.
TIA
Stacktrace:
D/AndroidRuntime( 2066): Shutting down VM
E/AndroidRuntime( 2066): FATAL EXCEPTION: main
E/AndroidRuntime( 2066): java.lang.UnsatisfiedLinkError: Couldn't load monodroid: findLibrary returned null
E/AndroidRuntime( 2066): at java.lang.Runtime.loadLibrary(Runtime.java:429)
E/AndroidRuntime( 2066): at java.lang.System.loadLibrary(System.java:554)
E/AndroidRuntime( 2066): at mono.MonoPackageManager.LoadApplication(MonoPackageManager.java:24)
E/AndroidRuntime( 2066): at mono.MonoRuntimeProvider.attachInfo(MonoRuntimeProvider.java:25)
E/AndroidRuntime( 2066): at android.app.ActivityThread.installProvider(ActivityThread.java:3554)
E/AndroidRuntime( 2066): at android.app.ActivityThread.installContentProviders(ActivityThread.java:3309)
E/AndroidRuntime( 2066): at android.app.ActivityThread.handleBindApplication(ActivityThread.java:3265)
E/AndroidRuntime( 2066): at android.app.ActivityThread.access$2200(ActivityThread.java:117)
E/AndroidRuntime( 2066): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:969)
E/AndroidRuntime( 2066): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 2066): at android.os.Looper.loop(Looper.java:123)
E/AndroidRuntime( 2066): at android.app.ActivityThread.main(ActivityThread.java:3683)
E/AndroidRuntime( 2066): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 2066): at java.lang.reflect.Method.invoke(Method.java:507)
E/AndroidRuntime( 2066): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
E/AndroidRuntime( 2066): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
E/AndroidRuntime( 2066): at dalvik.system.NativeStart.main(Native Method)
I/Process ( 2066): Sending signal. PID: 2066 SIG: 9
I had a similar problem not long after going with the paid version. Simply clean and rebuild to update the references to the new monodroid library.
See also: http://www.mail-archive.com/monodroid#lists.ximian.com/msg00531.html
This is very probably Android bug 21670: sometimes native libraries are not extracted from the .apk, but the installation is still reported as successful:
W/NativeHelper( 98): Failed to cache package shared libs
W/NativeHelper( 98): java.io.IOException: Couldn't create cached binary /data/data/Mono.Android.DebugRuntime/lib/libmonosgen-2.0.so in /data/data/Mono.Android.DebugRuntime/lib
W/NativeHelper( 98): at com.android.internal.content.NativeLibraryHelper.copyNativeBinaryLI(NativeLibraryHelper.java:289)
Check your Android Debug Logs for a message similar to the above to confirm that this is the case.
If you see the above, you need to uninstall your app and as many other packages as possible to free up storage space, then reinstall your app.

Categories

Resources