{"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":174,"created_at":"2015-06-06T21:03:59Z","updated_at":"2015-07-30T18:26:01Z","closed_at":null,"body":"Cordova 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, and do some other things...\r\n\r\nDue to some various Cordova 5 issues/bugs, an automated Cordova 5 version isn't currently available. Here are steps to make this plugin work for Cordova 5 (PLEASE NOTE THESE ARE STILL DRAFT INSTRUCTIONS):\r\n1) Create a ``/platforms/android/com.flyingsoftgames.xapkreader/`` directory.\r\n2) Copy your ``/plugins/com.flyingsoftgames.xapkreader/android-sdk/extras/google/play_apk_expansion/downloader_library`` directory contents and your ``/plugins/com.flyingsoftgames.xapkreader/android-sdk/extras/google/play_licensing/library`` directory contents to ``/platforms/android/com.flyingsoftgames.xapkreader/downloader_library`` and ``/platforms/android/com.flyingsoftgames.xapkreader/library``.\r\n3) Instead of the single reference we added before, add this instead to ``project.properties``:\r\n````\r\nandroid.library.reference.2=com.flyingsoftgames.xapkreader/downloader_library\r\nandroid.library.reference.3=com.flyingsoftgames.xapkreader/library\r\n````\r\n4) Inside ``downloader_library``, add a file named ``build-extras.gradle``, with the following contents:\r\n````\r\ndependencies {\r\ndebugCompile project(path: ':com.flyingsoftgames.xapkreader:library',configuration: \"debug\")\r\nreleaseCompile project(path: ':com.flyingsoftgames.xapkreader:library',configuration: \"release\")\r\n}\r\n````\r\n5) The automatic downloader DOES NOT SEEM TO WORK. We must disable it. In ``platforms/android/src/com/flyingsoftgames/xapkreader/XAPKDownloaderActivity.java``, change ``return isDebug;`` to ``return true;``.\r\n\r\n6a) 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\n6b)\r\nMake sure to add ``allow-navigation``, and ``allow-intent``, and extra ``access origin`` tags to ``config.xml``. E.G.:\r\n````\r\n    <allow-navigation href=\"*://*/*\"/>\r\n    <allow-intent href=\"*\" />\r\n    <access origin=\"*\" />\r\n    <access origin=\"content:///*\" />\r\n    <access origin=\"cdvfile:///*\" />\r\n````\r\nNOTE 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."},"comment":{"url":"https://api.github.com/repos/agamemnus/cordova-plugin-xapkreader/issues/comments/126424969","html_url":"https://github.com/agamemnus/cordova-plugin-xapkreader/issues/22#issuecomment-126424969","issue_url":"https://api.github.com/repos/agamemnus/cordova-plugin-xapkreader/issues/22","id":126424969,"user":{"login":"TheodoreLogan","id":591530,"avatar_url":"https://avatars.githubusercontent.com/u/591530?v=3","gravatar_id":"","url":"https://api.github.com/users/TheodoreLogan","html_url":"https://github.com/TheodoreLogan","followers_url":"https://api.github.com/users/TheodoreLogan/followers","following_url":"https://api.github.com/users/TheodoreLogan/following{/other_user}","gists_url":"https://api.github.com/users/TheodoreLogan/gists{/gist_id}","starred_url":"https://api.github.com/users/TheodoreLogan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TheodoreLogan/subscriptions","organizations_url":"https://api.github.com/users/TheodoreLogan/orgs","repos_url":"https://api.github.com/users/TheodoreLogan/repos","events_url":"https://api.github.com/users/TheodoreLogan/events{/privacy}","received_events_url":"https://api.github.com/users/TheodoreLogan/received_events","type":"User","site_admin":false},"created_at":"2015-07-30T18:26:01Z","updated_at":"2015-07-30T18:26:01Z","body":"> A JavaScript event should be fired when the down load is complete OR when the file is already present\r\n\r\nI worked around this by checking for files every 5 seconds in JS. However, the XAPKProvider doesn't attempt to re-find the expansion apk once it has been download from google; every expansion content request returns 404 until the app is restarted."}}