Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile issues using api 27+ (probably 23+) and cordova android 7.1.1 #133

Open
chancezeus opened this issue Aug 15, 2018 · 4 comments
Open

Comments

@chancezeus
Copy link

I ran into various compile issues (undefined properties, missing "org.apache.http", etc) when trying to compile an android project with cordova-android version 7.1.1. Looking to solve some of the problems I googled around and found this github repo: https://github.com/danikula/Google-Play-Expansion-File. Since most of the problems originated from the expansion libraries I decided to try and resolve at least that part by using these pre-compiled versions.

Simply put:
Step 1: create a build-xapkreader.gradle with the following content

repositories {
    maven { url 'https://dl.bintray.com/alexeydanilov/apk-expansion' }
}

Step 2: replace the following

<framework src="android-sdk/extras/google/play_apk_expansion/downloader_library" custom="true"/>
<framework src="android-sdk/extras/google/play_licensing/library" custom="true" />

with

<framework src="build-xapkreader.gradle" custom="true" type="gradleReference" />
<framework src="com.danikula.expansion:expansion:1.3.4@aar" />
<framework src="com.danikula.expansion:license:1.7.0@aar" />

Et voila: the app compiles

The last remaining issue is a folder structure issue, namely the res/values/xapkreader.xml has moved from the platforms/android folder into the platforms/android/app/src/main folder, leading to some warnings during plugin install because it cannot update the preferences properly. The only solution I can think of for this issue is using a hook instead defining these updates in config.xml, but I leave that till a later moment.

For now I suggest at least removing the uncompiled versions of the downloader and licensing libraries and using either the provided solution or compile them yourself and provide the resulting aar file(s) with the plugin (please PM if you need info on howto add "local" aar files, did that for a different custom plugin too).

@chancezeus chancezeus changed the title Compile issues on using api 27+ (probably 23+) and cordova android 7.1.1 Compile issues using api 27+ (probably 23+) and cordova android 7.1.1 Aug 15, 2018
@chancezeus
Copy link
Author

chancezeus commented Aug 15, 2018

Found the fix for the folder structure issue too according to the docs (see https://cordova.apache.org/docs/en/6.x/plugin_ref/spec.html#config-file) you can use a * as a wildcard and it will search the entire directory until it finds a matching file so instead of <config-file target="res/values/xapkreader.xml" parent="/*"> you should use <config-file target="*/values/xapkreader.xml" parent="/*">

@agamemnus
Copy link
Owner

Thanks for these helpful tips.

@chancezeus
Copy link
Author

You're welcome, I find it interesting that google removed (or at least "blacklisted") the entire org.apache.http module, but never updated their own apk expansion (related) libraries. My first step towards fixing it was replacing the provided libraries with the newest (locally installed) versions, but that too was complaining about the missing org.apache.http imports.

@agamemnus
Copy link
Owner

It's definitely interesting...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants