moust / phonegap-xapkreader

Cordova plugin to access files in APK Expansion Files
13 stars 17 forks source link

sdk path? + Media plugin issues (crash) #6

Closed agamemnus closed 10 years ago

agamemnus commented 10 years ago
/extras/google/google_market_apk_expansion/zip_file Shouldn't it be: /extras/google/google_play_apk_expansion/zip_file ?
agamemnus commented 10 years ago

Actually, I guess I don't understand this whole section below. This doesn't seem to work:

android update project --path ~/Android/MyApp --library ~/android_sdk/extras/google/play_licensing --library ~/android_sdk/extras/google/play_apk_expansion/downloader_library

Further, you need to add the your application the Downloader Library and APK Expansion Zip Library from the Android Extras section using the Android SDK manager (run android).

This libraries are respectively located in :

    APK Expansion Zip Library : <sdk>/extras/google/google_market_apk_expansion/zip_file/
    Downloader Library : <sdk>/extras/google/market_apk_expansion/downloader_library/

Note that the Downloader Library require the Google Play Licensing Library located in <sdk>/extras/google/market_licensing/.

You can find an explanation on how to do this in the following page : Preparing to use the Downloader Library
adys123 commented 10 years ago

try this https://github.com/psyon/phonegap-xapkreader the same thing but much better and easier

agamemnus commented 10 years ago

I am actually using that, but this still needs me to add those library files, or am I wrong?

adys123 commented 10 years ago

ohh.. those library files have different names.. I mean instead of google market expansion you have google play expansion. And so on. I think this is what you mean, right?

agamemnus commented 10 years ago

Ok, this is what I did.

1) Downloaded psyon's fork. 2) Copied the files from the Android SDK into my project -- e.g.: C:/myproject/android-sdk/extras/google/play_apk_expansion and C:/myproject/android-sdk/extras/google/play_licensing. 3) Added in my project.properties file these paths: android.library.reference.2=android-sdk/extras/google/play_apk_expansion/downloader_library android.library.reference.3=android-sdk/extras/google/play_apk_expansion/zip_file (I had one reference already which is why it is .2 and .3.) 4) Modified the project.properties library reference to in downloader_library to: android.library.reference.1=../../../google/play_licensing/library (for example...) 5) Added build.xml files with dummy project names to downloader_library, zip_file, and play_licensing. 6) Modified XAPKDownloaderActivity.java to import my app's R file: import com.my.project.R;. 7) Ran "ant debug" on all three applications, separately.

agamemnus commented 10 years ago

Google changed the directory structure.. without changing the rest of the code, or the documentation...

Anyway, I must be doing something wrong to have to do all of the above manually.

agamemnus commented 10 years ago

After spending 8 hours trying to get this to work, I realized that running anything through the Cordova Media created an incorrect URL. (like "file:///android_asset/0/content://" ...).. and eventually (very quickly) led to some sort of null pointer and a crash.

Fortunately my sound files added to my regular APK and removed from the expansion APK did the trick. A bit of a kludge now...

agamemnus commented 10 years ago

It would be nice if everything from https://github.com/moust/phonegap-xapkreader/issues/6#issuecomment-54352399 was automated!

moust commented 10 years ago

It would be nice, but the plugman's implementation does provides any means to add an external library to the project. Or at least I have not found any way to do it.

Concerning the import com.my.project.R; import in the XAPKDownloaderActivity.java file, it's maybe possible to replace it by something else but I'm not good enough in Android developement to know how to do it otherwise without removing translation of the downloder's dialog... If someone have any idea to how doing it would be great.

agamemnus commented 10 years ago

It is possible. Take a look at this: https://github.com/ludei/cocoonjs-cli.

If you look in the https://github.com/ludei/webview-plus README instructions, you will see the manual way to add in webview-plus and the automatic way (using the CocoonJS CLI). After installing the webview-plus plugin, there is a file in the source code that specifies exactly what to change and how in order to do an uninstall. Just reverse the process for an install, I guess.