{"action":"created","issue":{"url":"https://api.github.com/repos/agamemnus/cordova-plugin-xapkreader/issues/22","labels_url":"https://api.github.com/repos/agamemnus/cordova-plugin-xapkreader/issues/22/labels{/name}","comments_url":"https://api.github.com/repos/agamemnus/cordova-plugin-xapkreader/issues/22/comments","events_url":"https://api.github.com/repos/agamemnus/cordova-plugin-xapkreader/issues/22/events","html_url":"https://github.com/agamemnus/cordova-plugin-xapkreader/issues/22","id":85811880,"number":22,"title":"Gradle patch (work in progress)","user":{"login":"agamemnus","id":3230040,"avatar_url":"https://avatars.githubusercontent.com/u/3230040?v=3","gravatar_id":"","url":"https://api.github.com/users/agamemnus","html_url":"https://github.com/agamemnus","followers_url":"https://api.github.com/users/agamemnus/followers","following_url":"https://api.github.com/users/agamemnus/following{/other_user}","gists_url":"https://api.github.com/users/agamemnus/gists{/gist_id}","starred_url":"https://api.github.com/users/agamemnus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/agamemnus/subscriptions","organizations_url":"https://api.github.com/users/agamemnus/orgs","repos_url":"https://api.github.com/users/agamemnus/repos","events_url":"https://api.github.com/users/agamemnus/events{/privacy}","received_events_url":"https://api.github.com/users/agamemnus/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":130,"created_at":"2015-06-06T21:03:59Z","updated_at":"2015-06-11T16:07:05Z","closed_at":null,"body":"NOTE 1: Please do not post any logs here (unless absolutely necessary)!\r\nNOTE 2: If you are on Crosswalk, note that you *must* use the plugin method for Cordova 5+ builds. The migrate method no longer works.\r\nNOTE 3: Cordova 5 has a whitelist plugin requirement. New builds have it by default. You must add this: ``cordova plugin add cordova-plugin-whitelist``. In your ``index.html`` file, you also need to add a Content-Security-Policy meta tag. Note that the instructions on the whitelist plugin on github do not show the most permissive meta tag and forget about ``content://`` or ``cdvfile://``. The most permissive meta tag seems to be: ``<meta http-equiv=\"Content-Security-Policy\" content=\"* * 'self' default-src 'unsafe-inline' 'unsafe-eval' http://* https://* data: cdvfile://* content://*;\">``. (content:// and cdvfile:// should really be included by default. If you want to omit those, I made a patch here: https://github.com/agamemnus/cordova-plugin-whitelist)\r\n\r\nCordova 5 ignores the ant build system. It uses gradle, instead. That means that the links to the Google Play downloader and licensing libraries are broken. To fix that, we need to use a ``build-extras.gradle`` file which substitutes for the ``project.properties`` file.\r\n\r\nIn this plugin, there are two project.properties files:\r\n1) There is one that links to ``plugins\\com.flyingsoftgames.xapkreader\\android-sdk\\extras\\google\\play_apk_expansion\\downloader_library``, which one must add manually. E.G.:\r\n``android.library.reference.2=../../plugins/com.flyingsoftgames.xapkreader/android-sdk/extras/google/play_apk_expansion/downloader_library``\r\n2) There is one that links the downloader library to the licensing library. Its contents look like this, for example:\r\n````\r\ntarget=android-22\r\nandroid.library=true\r\nandroid.library.reference.1=../../../google/play_licensing/library\r\n````\r\n\r\nFor (1), I created a ``build-extras.gradle`` file in ``/platforms/android`` with the following content:\r\n````\r\ndependencies {\r\n debugCompile project(path: ':..:..:plugins:com.flyingsoftgames.xapkreader:android-sdk:extras:google:play_apk_expansion:downloader_library',configuration: \"debug\")\r\n releaseCompile project(path: ':..:..:plugins:com.flyingsoftgames.xapkreader:android-sdk:extras:google:play_apk_expansion:downloader_library',configuration: \"release\")\r\n}\r\n````\r\nFor (2), I am as yet unable to link the library file, after a number of different attempts. It just can't find it. Apparently there's some bug in Cordova 5/Android 4 which requires a PROJECTNAME prefix (see https://github.com/imaffett/APKexpansion/blob/master/README.md), but I have been unable to figure out what PROJECTNAME is."},"comment":{"url":"https://api.github.com/repos/agamemnus/cordova-plugin-xapkreader/issues/comments/111186764","html_url":"https://github.com/agamemnus/cordova-plugin-xapkreader/issues/22#issuecomment-111186764","issue_url":"https://api.github.com/repos/agamemnus/cordova-plugin-xapkreader/issues/22","id":111186764,"user":{"login":"mattrayner","id":3502902,"avatar_url":"https://avatars.githubusercontent.com/u/3502902?v=3","gravatar_id":"","url":"https://api.github.com/users/mattrayner","html_url":"https://github.com/mattrayner","followers_url":"https://api.github.com/users/mattrayner/followers","following_url":"https://api.github.com/users/mattrayner/following{/other_user}","gists_url":"https://api.github.com/users/mattrayner/gists{/gist_id}","starred_url":"https://api.github.com/users/mattrayner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattrayner/subscriptions","organizations_url":"https://api.github.com/users/mattrayner/orgs","repos_url":"https://api.github.com/users/mattrayner/repos","events_url":"https://api.github.com/users/mattrayner/events{/privacy}","received_events_url":"https://api.github.com/users/mattrayner/received_events","type":"User","site_admin":false},"created_at":"2015-06-11T16:07:05Z","updated_at":"2015-06-11T16:07:05Z","body":"I got the example working under cordova 4 so I've rolled my project back but the plugin is throwing a null pointer error now\r\n\r\n```\r\n06-11 17:05:33.356: W/System.err(15861): java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.res.AssetFileDescriptor com.flyingsoftgames.xapkreader.XAPKZipResourceFile.getAssetFileDescriptor(java.lang.String)' on a null object reference\r\n\r\n```\r\n\r\nSorry to be a pain :("}}