ccd
ccd

Reputation: 6948

how to add android.support.v7.app on react-native

I have created a SplashActivity class under main package

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. How can add it?

react-native version: 0.60.4.

Upvotes: 1

Views: 646

Answers (1)

Minh Hưng Trần
Minh Hưng Trần

Reputation: 519

If you are using androidX, you will get this error. You can check it on

android/gradle.properties

AndroidX enable: android.useAndroidX=true android.enableJetifier=true

If androidX was enabled, you must change from android.support.v7.app to androidx.appcompat.app

You should check how to migrate to 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

Upvotes: 3

Related Questions