I start with google drive sdk. I follows steps which describe in that post.
But I face problem in Step 3: Create and Configure an Android Project
I cant find options in my eclipse so I add plugins for google. After installation of plugins, Eclipse give errors and we now update my SDK also. So for that I update my SDK but now All projects giving me error in eclipse. I cant run any projects. So I use my old SDK back.
Now I stuck with this How to create Project for Google Drive and how to integrate it.
I need to upload file from my android application to Google Drive.
Please help me to find this.
EDIT
Now I successfully create project with error free. But when I run project it give me following errors.
12-12 11:05:08.788: E/AndroidRuntime(377): java.lang.NoClassDefFoundError: com.google.api.client.googleapis.extensions.android.gms.auth.GoogleAccountCredential
12-12 11:05:08.788: E/AndroidRuntime(377): at com.rarenoice.screen.MainActivity.onCreate(MainActivity.java:42)
12-12 11:05:08.788: E/AndroidRuntime(377): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
12-12 11:05:08.788: E/AndroidRuntime(377): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
12-12 11:05:08.788: E/AndroidRuntime(377): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
12-12 11:05:08.788: E/AndroidRuntime(377): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
12-12 11:05:08.788: E/AndroidRuntime(377): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
12-12 11:05:08.788: E/AndroidRuntime(377): at android.os.Handler.dispatchMessage(Handler.java:99)
12-12 11:05:08.788: E/AndroidRuntime(377): at android.os.Looper.loop(Looper.java:123)
12-12 11:05:08.788: E/AndroidRuntime(377): at android.app.ActivityThread.main(ActivityThread.java:4627)
12-12 11:05:08.788: E/AndroidRuntime(377): at java.lang.reflect.Method.invokeNative(Native Method)
12-12 11:05:08.788: E/AndroidRuntime(377): at java.lang.reflect.Method.invoke(Method.java:521)
12-12 11:05:08.788: E/AndroidRuntime(377): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
12-12 11:05:08.788: E/AndroidRuntime(377): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
12-12 11:05:08.788: E/AndroidRuntime(377): at dalvik.system.NativeStart.main(Native Method)
At Following line :-
private GoogleAccountCredential credential;
credential = GoogleAccountCredential.usingOAuth2(MainActivity.this,
DriveScopes.DRIVE);
You need to add the Google Play Services jars to your project, as explained in Step 3 of the quickstart guide you are following.
You can also watch this video where I go through all the steps to build the same quickstart application for Android: http://www.youtube.com/watch?v=Ied1CjJ0iP0
Related
Hi am running Android tesseract sample project by adding tess-two as library project as prerequisite for this project
also i put google translator api key and bing translator api key in this project
but when am going to run this project it shows me following error in logcat
can you please help me to out from this situation
thanks in advance
FATAL EXCEPTION: main
E/AndroidRuntime(20521): java.lang.ExceptionInInitializerError
E/AndroidRuntime(20521): at edu.sfsu.cs.orange.ocr.CaptureActivity.initOcrEngine(CaptureActivity.java:711)
E/AndroidRuntime(20521): at edu.sfsu.cs.orange.ocr.CaptureActivity.onResume(CaptureActivity.java:368)
E/AndroidRuntime(20521): at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1153)
E/AndroidRuntime(20521): at android.app.Activity.performResume(Activity.java:3858)
E/AndroidRuntime(20521): at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2122)
E/AndroidRuntime(20521): at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2147)
E/AndroidRuntime(20521): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1680)
E/AndroidRuntime(20521): at android.app.ActivityThread.access$1500(ActivityThread.java:121)
E/AndroidRuntime(20521): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:943)
E/AndroidRuntime(20521): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime(20521): at android.os.Looper.loop(Looper.java:130)
E/AndroidRuntime(20521): at android.app.ActivityThread.main(ActivityThread.java:3770)
E/AndroidRuntime(20521): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(20521): at java.lang.reflect.Method.invoke(Method.java:507)
E/AndroidRuntime(20521): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:912)
E/AndroidRuntime(20521): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:670)
E/AndroidRuntime(20521): at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime(20521): Caused by: java.lang.UnsatisfiedLinkError: Couldn't load lept: findLibrary returned null
E/AndroidRuntime(20521): at java.lang.Runtime.loadLibrary(Runtime.java:429)
E/AndroidRuntime(20521): at java.lang.System.loadLibrary(System.java:554)
E/AndroidRuntime(20521): at com.googlecode.tesseract.android.TessBaseAPI.<clinit>(TessBaseAPI.java:44)
E/AndroidRuntime(20521): ... 17 more
Your problem is with:
Caused by: java.lang.UnsatisfiedLinkError: Couldn't load lept: findLibrary returned null
You need to include the 'lept' jar and native c++ files in your project and reference them in your build path.
Also, take a look at best OCR (Optical character recognition) example in android
I uploaded an app to the playstore. The app contains native C code. I compiled it successfully using NDK, created the signed apk. I also installed the signed apk and checked. Everything worked fine.
After uploading it I downloaded it from playstore and it crashed.
Following is the stack trace:
java.lang.ExceptionInInitializerError
at java.lang.Class.newInstanceImpl(Native Method)
at java.lang.Class.newInstance(Class.java:1319)
at android.app.Instrumentation.newActivity(Instrumentation.java:1057)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2015)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2125)
at android.app.ActivityThread.access$600(ActivityThread.java:140)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1227)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4898)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1006)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.UnsatisfiedLinkError: Couldn't load hello-jni: findLibrary returned null
at java.lang.Runtime.loadLibrary(Runtime.java:365)
at java.lang.System.loadLibrary(System.java:535)
at com.somepackage.anotherpackage.SomeActivity.<clinit>(SomeActivity.java:56)
... 15 more
The error states that System.loadLibrary returned null. But the same code when run using eclipse works fine.
Thanks for any help
Seems like your apk is missing libhello-jni.so. Maybe it was not packaged during apk build.
If you open your apk with a zip software, you should have a folder libs containing libhello-jni.so : if you don't have it, then you forgot something at build time.
I have android app in market so I get this error but I don't know why.
Exception class java.lang.NoClassDefFoundError
Source method MainActivity.onCreate()
java.lang.NoClassDefFoundError: android.app.DownloadManager
at com.example.viewpagerexample.MainActivity.onCreate(MainActivity.java:182)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1069)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2751)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2803)
at android.app.ActivityThread.access$2300(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2136)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:144)
at android.app.ActivityThread.main(ActivityThread.java:4937)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
at dalvik.system.NativeStart.main(Native Method)
DownloadManager was added on API level 9 (aka Gingerbread).
My guess you declared minSDK as lower than 9 in your AndroidManifest.xml
If that is the case, you need to devise a workaround for users using older Android version.
You can check on which version your app is running by using the following code:
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) {
// Use DownloadManager
}
else {
// Workaround
}
I'm trying to make a restricted version of barcode scanner, which can only scan 2d data matrices. I figured the best way to do this would be to get the latest source from ZXing svn repository, build the core.jar, include it in the app lib, and work from there.
However, to see how various components in the app work I tried to run the barcode scanner app using the android source code in the ZXing repository. To do this I followed instructions given on
https://stackoverflow.com/a/4854637/1273954
https://stackoverflow.com/a/4825803/1273954
& also http://damianflannery.wordpress.com/2011/06/13/integrate-zxing-barcode-scanner-into-your-android-app-natively-using-eclipse/
All these posts inherently talk about the same thing and same approach. However, each time I run the application, my device says "Unfortunately, Barcode SCanner has stopped"
Here is what logcat shows :
12-12 17:18:56.213: E/AndroidRuntime(15408): FATAL EXCEPTION: main
12-12 17:18:56.213: E/AndroidRuntime(15408): java.lang.ExceptionInInitializerError
12-12 17:18:56.213: E/AndroidRuntime(15408): at java.lang.Class.newInstanceImpl(Native Method)
12-12 17:18:56.213: E/AndroidRuntime(15408): at java.lang.Class.newInstance(Class.java:1319)
12-12 17:18:56.213: E/AndroidRuntime(15408): at android.app.Instrumentation.newActivity(Instrumentation.java:1023)
12-12 17:18:56.213: E/AndroidRuntime(15408): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1964)
12-12 17:18:56.213: E/AndroidRuntime(15408): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2083)
12-12 17:18:56.213: E/AndroidRuntime(15408): at android.app.ActivityThread.access$600(ActivityThread.java:134)
12-12 17:18:56.213: E/AndroidRuntime(15408): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1233)
12-12 17:18:56.213: E/AndroidRuntime(15408): at android.os.Handler.dispatchMessage(Handler.java:99)
12-12 17:18:56.213: E/AndroidRuntime(15408): at android.os.Looper.loop(Looper.java:137)
12-12 17:18:56.213: E/AndroidRuntime(15408): at android.app.ActivityThread.main(ActivityThread.java:4697)
12-12 17:18:56.213: E/AndroidRuntime(15408): at java.lang.reflect.Method.invokeNative(Native Method)
12-12 17:18:56.213: E/AndroidRuntime(15408): at java.lang.reflect.Method.invoke(Method.java:511)
12-12 17:18:56.213: E/AndroidRuntime(15408): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:787)
12-12 17:18:56.213: E/AndroidRuntime(15408): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:554)
12-12 17:18:56.213: E/AndroidRuntime(15408): at dalvik.system.NativeStart.main(Native Method)
12-12 17:18:56.213: E/AndroidRuntime(15408): Caused by: java.lang.NoClassDefFoundError: com.google.zxing.ResultMetadataType
12-12 17:18:56.213: E/AndroidRuntime(15408): at com.google.zxing.client.android.CaptureActivity.<clinit>(CaptureActivity.java:96)
12-12 17:18:56.213: E/AndroidRuntime(15408): ... 15 more
The Posts also speak about modifications to the file androidManifest.xml. I have no idea what modifications to make there.
Any help or redirection or resource reference in this would be appreciated.
You're getting a NoClassDefFoundError. This means your jar file is not available at runtime. In order for it to be available at runtime you'll have to check the checkboxes on your jar file in your java build path like so:
There is an error in my Android application that happens quite often, based on the crash report on the Developer Console.
java.lang.NullPointerException
at android.widget.AbsListView.obtainView(AbsListView.java:1304)
at android.widget.ListView.measureHeightOfChildren(ListView.java:1198)
at android.widget.ListView.onMeasure(ListView.java:1109)
at android.view.View.measure(View.java:8171)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3132)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1012)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:381)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:304)
at android.view.View.measure(View.java:8171)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3132)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:245)
at android.view.View.measure(View.java:8171)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:526)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:304)
at android.view.View.measure(View.java:8171)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3132)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:245)
at android.view.View.measure(View.java:8171)
at android.view.ViewRoot.performTraversals(ViewRoot.java:801)
at android.view.ViewRoot.handleMessage(ViewRoot.java:1727)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4627)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:878)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:636)
at dalvik.system.NativeStart.main(Native Method)
Unfortunately, I can't replicate that error on my Android phone.
I dont' know where to start: in the trace there isn't any reference to my code.
Can somebody give me some suggestions on how to identify the root of the problem, please?
Thanks,
Dan
The most obvious things I can think of:
AbsListView.obtainView() I believe is communicating with the Adopter to populate the list view. Make sure there is never a case where you could return a null back to the list view.
There may be a bug in some version of the platform. Unfortunately the developer console does not currently show you the platform version the error reports came from. Hopefully this will be added in the future to help diagnose such a situation.
It is possible someone is running a non-standard or custom build of the platform that has bugs. You might be able to determine this by looking at the "platforms" section for the different devices the error is coming from.
I would try creating a virtual device and load it in the emulator, start with the smallest resolution.
I am suspecting that it has to do with screen size and somehow you are trying to draw in a pixel that doesn't exist.