Reputation: 6128
I am working on APK Expansion files, i have looked into these links:
1) Steps to create APK expansion file
2)http://ankitthakkar90.blogspot.in/2013/01/apk-expansion-files-in-android-with.html
i have imported market_licensing, play_apk_expansion from the path sdk-path/extras/google
play_apk_expansion contains three projects downloader_library, zip_file, downloader_sample.
Now i have SampleDownloaderActivity where i am facing the problem:
I have still not yet uploaded the apk file in the console, i am trying to test the SampleDownloaderActivity proj, but i get this error:
02-21 12:54:13.150: E/AndroidRuntime(544): FATAL EXCEPTION: main
02-21 12:54:13.150: E/AndroidRuntime(544): java.lang.IllegalArgumentException: java.security.spec.InvalidKeySpecException: java.io.EOFException: DEF length 67 object truncated by 48
02-21 12:54:13.150: E/AndroidRuntime(544): at com.google.android.vending.licensing.LicenseChecker.generatePublicKey(LicenseChecker.java:121)
02-21 12:54:13.150: E/AndroidRuntime(544): at com.google.android.vending.licensing.LicenseChecker.<init>(LicenseChecker.java:92)
02-21 12:54:13.150: E/AndroidRuntime(544): at com.google.android.vending.expansion.downloader.impl.DownloaderService$LVLRunnable.run(DownloaderService.java:765)
02-21 12:54:13.150: E/AndroidRuntime(544): at android.os.Handler.handleCallback(Handler.java:587)
02-21 12:54:13.150: E/AndroidRuntime(544): at android.os.Handler.dispatchMessage(Handler.java:92)
02-21 12:54:13.150: E/AndroidRuntime(544): at android.os.Looper.loop(Looper.java:130)
02-21 12:54:13.150: E/AndroidRuntime(544): at android.app.ActivityThread.main(ActivityThread.java:3683)
02-21 12:54:13.150: E/AndroidRuntime(544): at java.lang.reflect.Method.invokeNative(Native Method)
02-21 12:54:13.150: E/AndroidRuntime(544): at java.lang.reflect.Method.invoke(Method.java:507)
02-21 12:54:13.150: E/AndroidRuntime(544): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
02-21 12:54:13.150: E/AndroidRuntime(544): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
02-21 12:54:13.150: E/AndroidRuntime(544): at dalvik.system.NativeStart.main(Native Method)
02-21 12:54:13.150: E/AndroidRuntime(544): Caused by: java.security.spec.InvalidKeySpecException: java.io.EOFException: DEF length 67 object truncated by 48
02-21 12:54:13.150: E/AndroidRuntime(544): at org.bouncycastle.jce.provider.JDKKeyFactory.engineGeneratePublic(JDKKeyFactory.java:92)
02-21 12:54:13.150: E/AndroidRuntime(544): at org.bouncycastle.jce.provider.JDKKeyFactory$RSA.engineGeneratePublic(JDKKeyFactory.java:396)
02-21 12:54:13.150: E/AndroidRuntime(544): at java.security.KeyFactory.generatePublic(KeyFactory.java:177)
02-21 12:54:13.150: E/AndroidRuntime(544): at com.google.android.vending.licensing.LicenseChecker.generatePublicKey(LicenseChecker.java:112)
as far as i know its the problem with BASE64_PUBLIC_KEY, but i have not given any key as such since i havent uploaded the apk,and also how to create the obb file, i have around 100 images which is around 40mb, where do i need to put these files?
Upvotes: 1
Views: 2622
Reputation: 1804
Update for those reading this post:
NOTE 1
You can't use draft anymore as the link to get the expansion file won't be active yet. You have to upload a version to Alpha or Beta first with expansion file. (adding an expansion file is only possible from the second apk you upload and up) So make sure you see the apk expansion file listed when you click the details in the developer publish section under APK.
NOTE 2
If you are using android studio and want to make use of the downloader library don't just copy the package name and java files into your own app src directory. Import the downloader library in eclipse and choose export => gradle build files. Afterwards you can import the library as a module in android studio.
NOTE 3
Not sure of this but I also think it's neccesary to download the app atleast once through the play store and have access to it with the account on your test device. So if you are working with alpha create a google+ test group and add yourself or other test devices to it.
Upvotes: 0
Reputation: 20569
While using APK Expansion files in Android unlike earlier new android google play developer console in Account details
erlier per android google play developer console Account there is one public key, now per each app on the google play developer console Account has the unique public key.
for testin apk expansion file upload the app, after uploadin the apk you see some options like this
click on service & API
select the public key copy paste in your sample
public class SampleDownloaderService extends DownloaderService {
// stuff for LVL -- MODIFY FOR YOUR APPLICATION!
private static final String BASE64_PUBLIC_KEY ="paste here";
while uploading apk you should upload any file (may be zipped file) with any name.. you need to make sure of the size of the file you are uploading is the file size you have put in the sampledownloader Activity
private static final XAPKFile[] xAPKS = { new XAPKFile(true, 1, 425553759L)
1 is the android:versionCode specified in the manifest.
what you uploaded xapk file while uploading apk same file will be renamed and downloaded as obb file in sd card
For unziping the obb file and more in click here
Upvotes: 4