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

Add android X support #1226

Closed
vtrifonov opened this issue Dec 7, 2018 · 4 comments
Closed

Add android X support #1226

vtrifonov opened this issue Dec 7, 2018 · 4 comments
Milestone

Comments

@vtrifonov
Copy link
Contributor

Add androidX support.
In order to turn it on you need to add in the app.gradle file:

project.ext.useAndroidX = true

You can setandroidx.legacy:legacy-support-v4 (replaces com.android.support:support-v4) , androidx.appcompat:appcompat (eplaces com.android.support:appcompat-v7) and com.google.android.material:material (replaces com.android.support:design) versions setting the following variables:

project.ext.androidXLegacy = "1.0.0"
project.ext.androidXAppCompat = "1.1.0-alpha01"
project.ext.androidXMaterial = "1.1.0-alpha01"

Have in mind that in order to make the application work with android X you'll need to have a version of tns-core-modules and all the plugins you use which works with android X

@farfromrefug
Copy link
Contributor

@vtrifonov there are some missing pieces. In here
this:

codeTuples.add(new Tuple2<String, String>('android\\.support\\.multidex\\.MultiDex', 'androidx.multidex.MultiDex'))

        codeTuples.each { tuple ->
            ant.replaceregexp(match: tuple.first, replace: tuple.second, flags: 'g', byline: true) {
                fileset(dir: "$projectDir/src/main/java/com/tns/", includes: '*.java')
            }
        }

is needed to also update this file.

I successfully build using that change

@vtrifonov
Copy link
Contributor Author

Thanks for your feedback! We’ve added the update from above.

@webleaf
Copy link

webleaf commented Feb 19, 2019

I try to use Material DateTime Picker library (it worked fine until lib version 3.6.4)

dependencies {
    implementation "com.wdullaer:materialdatetimepicker:4.1.2"
}

But looks like it use AndroidX, so build failed with error:

/path_to_project/platforms/android/app/src/main/AndroidManifest.xml:22:18-91 Error:
        Attribute application@appComponentFactory value=(android.support.v4.app.CoreComponentFactory) from [com.android.support:support-compat:28.0.0] AndroidManifest.xml:22:18-91
        is also present at [androidx.core:core:1.1.0-alpha01] AndroidManifest.xml:22:18-86 value=(androidx.core.app.CoreComponentFactory).
        Suggestion: add 'tools:replace="android:appComponentFactory"' to <application> element at AndroidManifest.xml:21:2-44:16 to override.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed : Attribute application@appComponentFactory value=(android.support.v4.app.CoreComponentFactory) from [com.android.support:support-compat:28.0.0] AndroidManifest.xml:22:18-91
        is also present at [androidx.core:core:1.1.0-alpha01] AndroidManifest.xml:22:18-86 value=(androidx.core.app.CoreComponentFactory).
        Suggestion: add 'tools:replace="android:appComponentFactory"' to <application> element at AndroidManifest.xml:21:2-44:16 to override.

I've tried to add such lines to app.gradle, but build still failed:

project.ext {
  useAndroidX = true
}

Suggestion: add 'tools:replace="android:appComponentFactory"'... don't work too.
I have NS5.2.0
How should I configure my project to work with this lib?

@vtrifonov
Copy link
Contributor Author

@webleaf currently the tns-core-modules doesn't support AndroidX, so you won't be able to use it in a NativeScript application. The support in the modules would come in one of our next releases.

This issue was closed.
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

4 participants