[英]how to add android.support.v7.app on react-native
I have created a SplashActivity class under main package我在主包下创建了一个 SplashActivity 类
package com.mypackage;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity; // not found this library
public class SplashActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Intent intent = new Intent(this, MainActivity.class);
startActivity(intent);
finish();
}
}
The error show the v7 not exist when I compile this project.当我编译这个项目时,错误显示 v7 不存在。 How can add it?怎么能加呢?
react-native version: 0.60.4.反应原生版本:0.60.4。
If you are using androidX, you will get this error.如果您使用的是 androidX,则会出现此错误。 You can check it on你可以检查一下
android/gradle.properties android/gradle.properties
AndroidX enable: android.useAndroidX=true android.enableJetifier=true
AndroidX 启用: android.useAndroidX=true android.enableJetifier=true
If androidX was enabled, you must change from android.support.v7.app
to androidx.appcompat.app
如果启用了 androidX,则必须从android.support.v7.app
更改为androidx.appcompat.app
You should check how to migrate to androidx: https://developer.android.com/jetpack/androidx/migrate您应该检查如何迁移到 androidx: https : //developer.android.com/jetpack/androidx/migrate
If androidx was disabled, I think you need to follow: How do I add a library (android-support-v7-appcompat) in IntelliJ IDEA如果禁用了 androidx,我认为您需要遵循: 如何在 IntelliJ IDEA 中添加库 (android-support-v7-appcompat)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.