使用React Native App的Android Studio构建错误 [英] Android Studio building errors using react native app
问题描述
我一直在尝试使用expo工具xde使用react native创建一个应用,然后使用exp detach将其分离,当我在Android Studio中打开时,在构建时会遇到很多错误:
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.
如何在React Native中创建一个分离应用程序,并且在使用该应用程序时会有更流畅的体验
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:我正在使用Android Studio 3.1.1,并且我似乎在使用最新版本的Gradle [https:// services .gradle.org / distributions / gradle-4.4-all.zip] [1],如果这是来自react应用程序的前提,或者我已经通过Android Studio以某种方式进行了更新,则idk。
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.
我似乎也不再对app.build.graddle中的依赖项进行编译,并且它仍然抱怨我已经用实现代替了
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
推荐答案
由于错误状态,您必须在依赖中使用实现
替换 compile
As the error states, you have to replace compile
with implementation
in dependencies since compile is obsolete.
示例
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'
....
}
这篇关于使用React Native App的Android Studio构建错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!