0

I recently implemented the APK Expansion File code, described in http://developer.android.com/guide/market/expansion-files.html, into my app. I updated the manifest, created the Service and Receiver files and update my main activity onCreate() to conform to the instructions in the guide.

I created a signed apk of my app, and uploaded it to my Google Play account, along with the obb file. These were saved as "drafts".

I then used adb to install my signed APK onto my device and ran it and immediately got the following exception:


java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.myapp/com.example.myapp.MyApp}:
android.database.sqlite.SQLiteException: no such table: 
MetadataColumns: , while compiling: SELECT APKVERSION,_id,DOWNLOADSTATUS,DOWNLOADFLAGS FROM MetadataColumns LIMIT 1
  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java: 1821)
  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java: 1842)
  at android.app.ActivityThread.access$1500(ActivityThread.java: 132)
  at android.app.ActivityThread $H.handleMessage(ActivityThread.java:1038)
  at android.os.Handler.dispatchMessage(Handler.java:99)
  at android.os.Looper.loop(Looper.java:150)
  at android.app.ActivityThread.main(ActivityThread.java:4263)
  at java.lang.reflect.Method.invokeNative(Native Method)
  at java.lang.reflect.Method.invoke(Method.java:507)
  at com.android.internal.os.ZygoteInit $MethodAndArgsCaller.run(ZygoteInit.java:839)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
  at dalvik.system.NativeStart.main(Native Method)
Caused by: android.database.sqlite.SQLiteException: no such table:
MetadataColumns: , while compiling: SELECT APKVERSION,_id,DOWNLOADSTATUS,DOWNLOADFLAGS FROM MetadataColumns LIMIT 1
  at android.database.sqlite.SQLiteCompiledSql.native_compile(Native Method)
  at android.database.sqlite.SQLiteCompiledSql.compile(SQLiteCompiledSql.java: 92)
  at android.database.sqlite.SQLiteCompiledSql.<init>(SQLiteCompiledSql.java: 65)
  at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:83) 
  at android.database.sqlite.SQLiteQuery.<init>(SQLiteQuery.java: 49)
  at android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java: 53)
  at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java: 1438)
  at android.database.sqlite.SQLiteDatabase.rawQuery(SQLiteDatabase.java: 1406)
  at com.google.android.vending.expansion.downloader.impl.t.<init>(SourceFile: 76)
  at com.google.android.vending.expansion.downloader.impl.t.a(SourceFile: 44)
  at com.google.android.vending.expansion.downloader.impl.DownloaderService.a(SourceFile: 634)

What is interesting is that if I run my app through the Eclipse debugger, I can execute the code that caused the exception, and continue normal processing, getting a message "Download failed because you may not have purchased this app".

Any idea why, on a signed version, there is an SQLite exception in the downloader library, specifically DownloadsDB.java?

My Project Build Target is 2.3.3

I have the Google Play License, Downloader and Zip libraries referenced by my project

And I have the following in my manifest:

<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="15" /    
<uses-permission android:name="com.android.vending.CHECK_LICENSE" /
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<service android:name=".MyAppDownloaderService" />
<receiver android:name=".MyAppAlarmReceiver" />

TIA,

jb

user899352
  • 133
  • 1
  • 6

2 Answers2

0

I did not get exactly the same exception but this might be your problem:

http://code.google.com/p/android/issues/detail?id=31663

The code in DownloadsDB.java is a bit sloppy and occurrences of:

if (null != cur && cur.moveToFirst()) { ... }

must be changed to:

if (null != cur) { if (cur.moveToFirst()) { ... } }
  • I found out, later, that this doesn't eliminate the exceptions. And they don't really matter--the debugger was just warning me about them. I could simply just continue execution. – Peter Phillips Nov 03 '12 at 07:07
  • This code by itself has no use for asked question cuz it changes absolutely nothing. If you read a post by mentioned link the author had to split the IF condition just to make it able to close cursor when DB is empty (null != cur - true and cur.moveToFirst() - false). – Stan Aug 17 '14 at 06:08
-1

Yes but now approach has been changed a bit. each and every application has key,

this error comes basically for few reasons, make sure :

you are logged in from your test acoount into your device. key are same in your code as well. you have mentioned the size of expansion file in code correctly in bytes. after uploading wait for 3-4 hours, then it will start downloading, instantly it does not work.

UdiT
  • 609
  • 1
  • 6
  • 21