Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Notepad provider classnotfound error ing google drive sdk examples

After studying the google drive quickstart from android. I downloaded their example and got this error:

01-13 03:38:39.039: E/AndroidRuntime(29967): java.lang.RuntimeException: Unable to get provider com.example.android.notepad.NotePadProvider: java.lang.ClassNotFoundException: com.example.android.notepad.NotePadProvider in loader dalvik.system.PathClassLoader[/data/app/com.example.android.notepad-1.apk]
01-13 03:38:39.039: E/AndroidRuntime(29967):    at android.app.ActivityThread.installProvider(ActivityThread.java:3561)
01-13 03:38:39.039: E/AndroidRuntime(29967):    at android.app.ActivityThread.installContentProviders(ActivityThread.java:3313)
01-13 03:38:39.039: E/AndroidRuntime(29967):    at android.app.ActivityThread.handleBindApplication(ActivityThread.java:3269)
01-13 03:38:39.039: E/AndroidRuntime(29967):    at android.app.ActivityThread.access$2200(ActivityThread.java:117)
01-13 03:38:39.039: E/AndroidRuntime(29967):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:973)
01-13 03:38:39.039: E/AndroidRuntime(29967):    at android.os.Handler.dispatchMessage(Handler.java:99)
01-13 03:38:39.039: E/AndroidRuntime(29967):    at android.os.Looper.loop(Looper.java:130)
01-13 03:38:39.039: E/AndroidRuntime(29967):    at android.app.ActivityThread.main(ActivityThread.java:3687)
01-13 03:38:39.039: E/AndroidRuntime(29967):    at java.lang.reflect.Method.invokeNative(Native Method)
01-13 03:38:39.039: E/AndroidRuntime(29967):    at java.lang.reflect.Method.invoke(Method.java:507)
01-13 03:38:39.039: E/AndroidRuntime(29967):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
01-13 03:38:39.039: E/AndroidRuntime(29967):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625)
01-13 03:38:39.039: E/AndroidRuntime(29967):    at dalvik.system.NativeStart.main(Native Method)
01-13 03:38:39.039: E/AndroidRuntime(29967): Caused by: java.lang.ClassNotFoundException: com.example.android.notepad.NotePadProvider in loader dalvik.system.PathClassLoader[/data/app/com.example.android.notepad-1.apk]
01-13 03:38:39.039: E/AndroidRuntime(29967):    at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
01-13 03:38:39.039: E/AndroidRuntime(29967):    at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
01-13 03:38:39.039: E/AndroidRuntime(29967):    at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
01-13 03:38:39.039: E/AndroidRuntime(29967):    at android.app.ActivityThread.installProvider(ActivityThread.java:3546)
01-13 03:38:39.039: E/AndroidRuntime(29967):    ... 12 more

I followed the instructions here. What am I missing here?

like image 976
CodeAndWave Avatar asked Nov 13 '22 13:11

CodeAndWave


1 Answers

Chances are your Android version is old, as this ContentProvider.PipeDataWriter was added into API 11 upwards aka Honeycomb and later.

Notice the crucial line in the sample source

public class NotePadProvider extends ContentProvider 
                            implements 
                            PipeDataWriter<Cursor> {
    // SNIP 
}

Looking at the original source of the sample's AndroidManifest.xml dictates the minimum version of the SDK required is 16 (i.e. Android Ice Cream Sandwich or later)

<uses-sdk android:minSdkVersion="16" />

Running it on a older version of Android even if the minimum version was changed to reflect your current Android version, such as SDK 9 for Gingerbread, 8 for Froyo or 7 for Eclair, it will fail horribly with the ClassNotFoundException as the ContentProvider does not implement PipeDataWriter due to being non-existant in earlier versions of Android.

like image 84
t0mm13b Avatar answered Nov 15 '22 04:11

t0mm13b