- Could not find com.android.tools.build:gradle:8.1.1.
- Could not determine the dependencies of task ‘:app:compileDebugKotlin’.
- No online devices found.
- Unable to load script.
- generate index.android.bundle
- Crash on Android 5.1
Could not find com.android.tools.build:gradle:8.1.1.
- Check dependencies in
build.gradle
, ensure that the following dependency exists:
1 | dependencies { |
Open https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/8.1.1/gradle-8.1.1.pom in your browser and ensure it is accessible.
Sync project with gradle files
Could not determine the dependencies of task ‘:app:compileDebugKotlin’.
- Check your network connection and/or proxy settings.
No online devices found.
Unable to load script.
Make sure you’re either running Metro (run ‘npx react-native start’) or that your bundle ‘index.android.bundle’ is packaged correctly for release.
generate index.android.bundle
To generate the index.android.bundle
file for your React Native app in Android Studio, follow these steps:
- Open a Terminal or Command Prompt:
- Navigate to your project’s root directory using the terminal or command prompt.
- Run the Following Command:
- Execute the following command to generate the
index.android.bundle
file:react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res/
- This command will create the bundle file and place it in the specified location.
- Build Your App:
- After generating the bundle, you can proceed with building your app using Android Studio or by running the following command:
cd android && ./gradlew assembleRelease
- This will create the APK file for your React Native app.
- After generating the bundle, you can proceed with building your app using Android Studio or by running the following command:
Crash on Android 5.1
- Use the React Native 0.71.x version, newer versions have dropped support for Android 5.1
- Run the following command to create a TV project for Android 5.1+:
1 | npx [email protected] init TestApp [email protected] |
This command will create a new project named TestApp
in the TestApp
directory using the react-native-tvos
template.