Android Studio building errors using react native app

北慕城南 提交于 2019-11-28 04:23:10

问题


I have been trying to create an app using react native using expo tools xde and then detach it using exp detach, when I open in Android Studio I get quite many error when building like:

Using incompatible plugins for the annotation processing

Configuration 'compile' is obsolete and has been replaced with
'implementation' and 'api'. It will be removed at the end of 2018.
For more information see:
http://d.android.com/r/tools/update-dependency-configurations.html


The specified Android SDK Build Tools version (23.0.1) is ignored,
as it is below the minimum supported version (27.0.3) for Android
Gradle Plugin 3.1.1. Android SDK Build Tools 27.0.3 will be used. To
suppress this warning, remove "buildToolsVersion '23.0.1'" from your
build.gradle file, as each version of the Android Gradle Plugin now
has a default version of the build tools. Update Build Tools version
and sync project Open File


Configuration 'compile' is obsolete and has been replaced with
'implementation' and 'api'. It will be removed at the end of 2018.
For more information see:
http://d.android.com/r/tools/update-dependency-configurations.html


Configuration 'testCompile' is obsolete and has been replaced with
'testImplementation' and 'testApi'. It will be removed at the end of
2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html


Configuration 'testApi' is obsolete and has been replaced with
'testImplementation'.

Is this normal? you could ask me why did you detach, well for that I have reasons.

How can create a detach app in react native and have a bit smoother experience when it comes to compiling building the app in android studio?

ps: I am using Android Studio 3.1.1 and I somehow seem to be using latest version of Gradle [https://services.gradle.org/distributions/gradle-4.4-all.zip][1], idk if this comes from the prespective of the react app or I have somehow updated thru Android studio.

Also I do not seem to have anymore compile on my dependencies in app.build.graddle and it is still complaining about it I subtstituted with implementation already


回答1:


As the error states, you have to replace compile with implementation in dependencies since compile is obsolete.

Example

dependencies {
    implementation 'com.android.support:support-v4:25.4.0'
    implementation 'com.android.support:recyclerview-v7:25.4.0'
    implementation 'com.android.support:design:25.4.0'
    ....
}



回答2:


Please Note :

If you create an app with create-react-native-app and then detach you can still use most of Expo's feature such as maps for instance.

But if you create a react native project with react-native init you won't be able to use any of expo's feature.



来源:https://stackoverflow.com/questions/49812692/android-studio-building-errors-using-react-native-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!