agamemnus / cordova-plugin-xapkreader

Easily access Google Play APK expansion file data.
32 stars 55 forks source link

Documentation #59

Closed webplease closed 7 years ago

webplease commented 7 years ago

Hi,

I can not run the plugin properly. Where can I find a step-by-step integration?

Thanks

agamemnus commented 7 years ago

Are you using Cordova 5.3.1?

You can also try the instructions.txt in test-project-instructions-and-test-obb if the readme isn't enough.

If you're using > 5.3.1, this might help: https://github.com/agamemnus/cordova-plugin-xapkreader/issues/58.

webplease commented 7 years ago

I have:

Cordova CLI: 6.4.0 Ionic CLI Version: 2.1.12 Ionic App Lib Version: 2.1.7 ios-deploy version: 1.9.0 ios-sim version: 5.0.11 OS: OS X Yosemite Node Version: v7.1.0 Xcode version: Xcode 7.2.1 Build version 7C1002

Do u mean Cordova CLI ?

agamemnus commented 7 years ago

Well, yes.

webplease commented 7 years ago

where is instructions.txt ?

marcoturi commented 7 years ago

https://github.com/agamemnus/cordova-plugin-xapkreader/blob/cordova-5.3.1-auto/test-project-instructions-and-test-obb/instructions.txt

webplease commented 7 years ago

Agamemnus, i need your help.

In Gen 2015 I build an app with IONIC and I add xapkreader to read the expansions file ... all works great.

Now I'm updating my project ... but xapkreader seems not read the package. How can I debug to learn how isn't working ?

For example: if i remove plugin (cordova rm) and add it again with "cordova plugin add https://github.com/agamemnus/cordova-plugin-xapkreader#cordova-5.3.1-auto" i get:

Failed to install 'com.flyingsoftgames.xapkreader':Error: Variable(s) missing: XAPK_PUBLIC_KEY

Now I'm on Cordova CLI: 5.3.1 Ionic CLI Version: 2.1.12

webplease commented 7 years ago

update:

without "-auto" the plugin installs. But now:

Error:Error: Found item String/xapk_expansion_authority more than one time Error:Execution failed for task ':mergeDebugResources'.

.../platforms/android/res/values/xapkreader.xml: Error: Found item String/xapk_expansion_authority more than one time

:(

webplease commented 7 years ago

Solved manually editing xapkreader.xml into values ... now app starts, but contents in OBB are not accessible.

Is there a way to print (js alert) if and when the OBB is processed ?

agamemnus commented 7 years ago

I don't remember... Possibly not but I don't remember.. I think you need to do a clean install here...

webplease commented 7 years ago

on a clean project, new error:

Error:Execution failed for task ':processDebugResources'.

Error: more than one library with package name 'com.google.android.gms'

Have u an idea?

agamemnus commented 7 years ago

Are you using the forked project or mine?...

webplease commented 7 years ago

I'm using yours...

With "cordova plugin add https://github.com/agamemnus/cordova-plugin-xapkreader#cordova-5.3.1-auto" i get: Failed to install 'com.flyingsoftgames.xapkreader':Error: Variable(s) missing: XAPK_PUBLIC_KEY ... without "-auto" installs.

agamemnus commented 7 years ago

The auto needs the key right away, that's why.

Mine only works in Cordova 5.3.1...

agamemnus commented 7 years ago

com.google.android.gms -- you have more than one lib with that package name.

webplease commented 7 years ago

it's very strange. I reset project, first install cordova-google-play-services then xapkreader ... but i get this notice:

Installing "com.flyingsoftgames.xapkreader" for android Fetching plugin "com.google.play.services" via npm WARNING: com.google.play.services has been renamed to cordova-google-play-services. You may not be getting the latest version! We suggest you cordova plugin rm com.google.play.services and cordova plugin add cordova-google-play-services. Fetching plugin "com.google.play.services" via cordova plugins registry

agamemnus commented 7 years ago

It already installs it. Don't install it manually...

webplease commented 7 years ago

If I don't install cordova-google-play-services manually, i get:

cordova plugin add https://github.com/agamemnus/cordova-plugin-xapkreader#cordova-5.3.1

Fetching plugin "https://github.com/agamemnus/cordova-plugin-xapkreader" via git clone Repository "https://github.com/agamemnus/cordova-plugin-xapkreader" checked out to git ref "cordova-5.3.1". Installing "com.flyingsoftgames.xapkreader" for android Fetching plugin "com.google.play.services" via npm WARNING: com.google.play.services has been renamed to cordova-google-play-services. You may not be getting the latest version! We suggest you cordova plugin rm com.google.play.services and cordova plugin add cordova-google-play-services. Fetching plugin "com.google.play.services" via cordova plugins registry Failed to install 'com.flyingsoftgames.xapkreader':CordovaError: Failed to fetch plugin com.google.play.services via registry. Probably this is either a connection problem, or plugin spec is incorrect. Check your connection and plugin name/version/URL. Error: connect ETIMEDOUT 50.17.177.14:80 at /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/fetch.js:141:33 at _rejected (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:797:24) at /usr/local/lib/node_modules/cordova/node_modules/q/q.js:823:30 at Promise.when (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:1035:31) at Promise.promise.promiseDispatch (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:741:41) at /usr/local/lib/node_modules/cordova/node_modules/q/q.js:557:44 at flush (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:108:17) at nextTickCallbackWith0Args (node.js:420:9) at process._tickCallback (node.js:349:13) Failed to fetch plugin com.google.play.services via registry. Probably this is either a connection problem, or plugin spec is incorrect. Check your connection and plugin name/version/URL. Error: connect ETIMEDOUT 50.17.177.14:80

agamemnus commented 7 years ago

Just tried it; works. What do you get if you type cordova --version? You probably don't have 5.3.1!

webplease commented 7 years ago

cordova --version 5.3.1 :(

Incredible! (thanks for your support)

webplease commented 7 years ago

can't ping 50.17.177.14 ...

agamemnus commented 7 years ago

Oh, ok. I didn't add android platform. It looks like they deleted that version...

agamemnus commented 7 years ago

(or something else?)

agamemnus commented 7 years ago

Try using the 6.x.x fork... maybe the server is down or idk.

webplease commented 7 years ago

Ok, can u tell me how? I'm new on cordova :(

agamemnus commented 7 years ago

Please see issue #58 for some links.

webplease commented 7 years ago

Error:Execution failed for task ':com.flyingsoftgames.xapkreader:library:processDebugAndroidTestManifest'.

Manifest merger failed : uses-sdk:minSdkVersion 3 cannot be smaller than version 14 declared in library [android:CordovaLib:unspecified:debug] /Users/user/Documents/test/platforms/android/com.flyingsoftgames.xapkreader/test-library/build/intermediates/exploded-aar/android/CordovaLib/unspecified/debug/AndroidManifest.xml Suggestion: use tools:overrideLibrary="org.apache.cordova" to force usage

... I become crazy

agamemnus commented 7 years ago

Did you switch back to 6.x.x?

webplease commented 7 years ago

yes now I'm on cordova 6.4.0

agamemnus commented 7 years ago

Try using 6 or 6.3 etc to make sure to remove a potential issue.

webplease commented 7 years ago

on 6.3.1:

cordova plugin add https://github.com/j-live/cordova-plugin-xapkreader.git Fetching plugin "https://github.com/j-live/cordova-plugin-xapkreader.git" via git clone Repository "https://github.com/j-live/cordova-plugin-xapkreader.git" checked out to git ref "master". Installing "com.flyingsoftgames.xapkreader" for android Notice: com.google.play.services has been automatically converted to cordova-google-play-services and fetched from npm. This is due to our old plugins registry shutting down. Fetching plugin "cordova-google-play-services" via npm Installing "cordova-google-play-services" for android Error during processing of action! Attempting to revert... Failed to install 'cordova-google-play-services':CordovaError: Uh oh! "/Users/Sergio/Documents/test/platforms/android/cordova-google-play-services/test-google-play-services_lib" already exists! at copyNewFile (/Users/Sergio/Documents/test/platforms/android/cordova/lib/pluginHandlers.js:232:15) at handlers.framework.install (/Users/Sergio/Documents/test/platforms/android/cordova/lib/pluginHandlers.js:74:17) at Object.ActionStack.process (/Users/Sergio/Documents/test/platforms/android/cordova/node_modules/cordova-common/src/ActionStack.js:56:25) at PluginManager.doOperation (/Users/Sergio/Documents/test/platforms/android/cordova/node_modules/cordova-common/src/PluginManager.js:117:20) at PluginManager.addPlugin (/Users/Sergio/Documents/test/platforms/android/cordova/node_modules/cordova-common/src/PluginManager.js:147:17) at Api.addPlugin (/Users/Sergio/Documents/test/platforms/android/cordova/Api.js:198:10) at handleInstall (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/install.js:611:6) at /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/install.js:407:28 at _fulfilled (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:787:54) at self.promiseDispatch.done (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:816:30) Failed to install 'com.flyingsoftgames.xapkreader':CordovaError: Uh oh! "/Users/Sergio/Documents/test/platforms/android/cordova-google-play-services/test-google-play-services_lib" already exists! at copyNewFile (/Users/Sergio/Documents/test/platforms/android/cordova/lib/pluginHandlers.js:232:15) at handlers.framework.install (/Users/Sergio/Documents/test/platforms/android/cordova/lib/pluginHandlers.js:74:17) at Object.ActionStack.process (/Users/Sergio/Documents/test/platforms/android/cordova/node_modules/cordova-common/src/ActionStack.js:56:25) at PluginManager.doOperation (/Users/Sergio/Documents/test/platforms/android/cordova/node_modules/cordova-common/src/PluginManager.js:117:20) at PluginManager.addPlugin (/Users/Sergio/Documents/test/platforms/android/cordova/node_modules/cordova-common/src/PluginManager.js:147:17) at Api.addPlugin (/Users/Sergio/Documents/test/platforms/android/cordova/Api.js:198:10) at handleInstall (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/install.js:611:6) at /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/install.js:407:28 at _fulfilled (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:787:54) at self.promiseDispatch.done (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:816:30) Error: Uh oh! "/Users/Sergio/Documents/test/platforms/android/cordova-google-play-services/test-google-play-services_lib" already exists!

agamemnus commented 7 years ago

Make sure to use https://github.com/agwells/cordova-plugin-xapkreader/commits/cordova-6.3.

webplease commented 7 years ago

i don't understand ...what means ?

cordova plugin add https://github.com/agwells/cordova-plugin-xapkreader.git ?

agamemnus commented 7 years ago

Yes... You were using j-live's version, which may only work for 6.0...

webplease commented 7 years ago

Reset project, from blank, Cordova 6.0

ordova plugin add https://github.com/j-live/cordova-plugin-xapkreader.git Fetching plugin "https://github.com/j-live/cordova-plugin-xapkreader.git" via git clone Repository "https://github.com/j-live/cordova-plugin-xapkreader.git" checked out to git ref "master". Installing "com.flyingsoftgames.xapkreader" for android Notice: com.google.play.services has been automatically converted to cordova-google-play-services and fetched from npm. This is due to our old plugins registry shutting down. Fetching plugin "cordova-google-play-services" via npm Installing "cordova-google-play-services" for android Failed to install 'com.flyingsoftgames.xapkreader':CordovaError: Uh oh! "/Users/Sergio/Documents/test/plugins/com.flyingsoftgames.xapkreader/res/values/xapkreader.xml" not found! at copyFile (/Users/Sergio/Documents/test/platforms/android/cordova/lib/pluginHandlers.js:182:36) at copyNewFile (/Users/Sergio/Documents/test/platforms/android/cordova/lib/pluginHandlers.js:214:5) at handlers.source-file.install (/Users/Sergio/Documents/test/platforms/android/cordova/lib/pluginHandlers.js:34:13) at Object.ActionStack.process (/Users/Sergio/Documents/test/platforms/android/cordova/node_modules/cordova-common/src/ActionStack.js:56:25) at Api.addPlugin (/Users/Sergio/Documents/test/platforms/android/cordova/Api.js:205:20) at handleInstall (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/install.js:601:6) at /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/install.js:385:28 at _fulfilled (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:787:54) at self.promiseDispatch.done (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:816:30) at Promise.promise.promiseDispatch (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:749:13) Error: Uh oh! "/Users/Sergio/Documents/test/plugins/com.flyingsoftgames.xapkreader/res/values/xapkreader.xml" not found!

agamemnus commented 7 years ago

Hmm... looks familiar actually...... Try creating a test project from C:\test\ maybe.

webplease commented 7 years ago

i'm on Mac os ...

agamemnus commented 7 years ago

Try 6.3 with the 6.3 one..

webplease commented 7 years ago

I don't understand where the plugin is for 6.3 ... and how to install the agwells 6.3 version :(

agamemnus commented 7 years ago

Should be the same way.

cordova plugin add https://github.com/agwells/cordova-plugin-xapkreader#cordova-6.3 I think.

webplease commented 7 years ago

installs ...but

The app crashes ...

java.lang.RuntimeException: Unable to start activity ComponentInfo{it.webplease.test/it.webplease.test.MainActivity}: java.lang.IllegalArgumentException: Unknown URI content://it.webplease.test

agamemnus commented 7 years ago

:(

Did you modify it, as usual, after install?

webplease commented 7 years ago

after install, plugins/android.json not contains the strings ... so, as agwells write, I modify plugin.xml directly ... no lucky! :(

I not need cordova>6 ...but it's strange not working on 5.3.1 ....

agamemnus commented 7 years ago

I don't know what to say... check android.json to make sure they copied correctly.

webplease commented 7 years ago

a valid xapk_google_play_public_key is needed also to work on emulator?

agamemnus commented 7 years ago

Emulator? Oh dear.... well that shouldn't be an issue in debug mode.. but I don't know how well an emulator works. I remember I had problems with it.

webplease commented 7 years ago

d'oh! ahahhaha ...

webplease commented 7 years ago

what npm version do u use on 5.3.1 ?

agamemnus commented 7 years ago

I am using 3.10.8.

Anyway, please read https://github.com/agamemnus/cordova-plugin-xapkreader/issues/58#issuecomment-262381697.

webplease commented 7 years ago

Hi, finally all works on 6.4.0 !

In emulator and on my Nexus 5X, putting manually obb file in /sdcard/Android/obb/it.webplease.test works.

Now I release my app as Beta on Google Play ... when start appears "Downloading assets", after 1 second ... Error. Download failed ... :(

On Android Monitor log:

E/XAPKDownloader: ExpansionAPKFile doesn't exist or has a wrong size (main.1119.it.webplease.test.obb). 11-24 01:54:00.120 1238-1285/? W/System.err: com.google.android.vending.expansion.downloader.impl.DownloadThread$StopRequest: while writing destination file: java.io.FileNotFoundException: /storage/emulated/0/Android/data/it.webplease.test/main.1119.it.webplease.test.obb.tmp (No such file or directory)

agamemnus commented 7 years ago

What were you doing before? Of course it wouldn't load from the Google Play server if you didn't put it there, silly.

When releasing, make sure you put in the correct key and you have the patch file uploaded to Google's server.