[英]React-native Cant find package android.support.v7.app
我遇到了這個非常煩人的錯誤,它不會讓我構建......它說它找不到包 android.support.v7.app 我的 SplashScreen js 文件中到處都是錯誤
error: package android.support.v7.app does not exist
import android.support.v7.app.AppCompatActivity;
^
D:\FifaLeagueApp\FifaIL\android\app\src\main\java\com\fifail\SplashActivity.java:7: error: cannot find symbol
public class SplashActivity extends AppCompatActivity {
^
我會提供我的畢業證書(我認為問題來自他們,但我無法弄清楚究竟是什么原因造成的)
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext {
buildToolsVersion = "28.0.3"
minSdkVersion = 16
compileSdkVersion = 28
targetSdkVersion = 28
supportLibVersion = "28.0.0"
}
repositories {
google()
jcenter()
}
dependencies {
classpath('com.android.tools.build:gradle:3.4.2')
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
}
...
android {
compileSdkVersion rootProject.ext.compileSdkVersion
compileOptions {
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_1_8
}
...
defaultConfig {
applicationId "com.fifail"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0"
}
...
dependencies {
implementation project(':react-native-vector-icons')
implementation project(':react-native-splash-screen')
implementation project(':react-native-restart')
implementation project(':react-native-gesture-handler')
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation "com.facebook.react:react-native:+" // From node_modules
}
....
}
聽起來您已經啟用了AndroidX
檢查您的android / gradle.properties並禁用它
useAndroidX=true
至
useAndroidX=false
如果啟用此功能,則會跳過appcompat v7
編輯:如果您需要AndroidX做我上面提到的,並添加到您的android / app / build.gradle新版本的appcompat
implementation 'androidx.appcompat:appcompat:${rootProject.ext.supportLibVersion}'
並在android / build.gradle上
supportLibVersion = '1.0.0'
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.