Reputation: 5450
I am making a splash for android in react native and followed all the steps as said in this medium article : Splash Blog
However after following all the steps I am getting a error in splashActivity.java
file of :
error: package android.support.v7.app does not exist
I went through multiple answers in stack overflow yet didn't find a satisfying answer. NON DUPLICATE .
My react versions are :
"react": "16.8.6",
"react-native": "0.60.5",
My splashActivity.java file is :
package com.abc; // make sure this is your package name
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
public class SplashActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Intent intent = new Intent(this, MainActivity.class);
startActivity(intent);
finish();
}
}
My app/build.gradle
File :
dependencies {
implementation project(':react-native-linear-gradient')
implementation project(':react-native-vector-icons')
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "androidx.appcompat:appcompat:1.0.0"
implementation "com.facebook.react:react-native:+" // From node_modules
}
root level build.gradle
file :
buildscript {
ext {
buildToolsVersion = "28.0.3"
minSdkVersion = 19
compileSdkVersion = 28
targetSdkVersion = 28
supportLibVersion = "28.0.0"
}
Upvotes: 1
Views: 839
Reputation: 13578
If you use androidx (and you wan't to use it in an existing Project, where you didn't use it before), make sure you also have do the other Settings needed to use androidx in your Project.
For Example in /android/build.gradle set:
android.useAndroidX=true
android.enableJetifier=true
Additional Information see here: https://developer.android.com/jetpack/androidx/migrate
Upvotes: 1
Reputation: 5450
Answering my question if anyone finds it useful :
change import android.support.v7.app.AppCompatActivity;
to import androidx.appcompat.app.AppCompatActivity;
Upvotes: 1