

React Native 初心者です。

`yarn run android` すると下記のようなエラーになり、アプリがエミュレータで起動しません。

どのような原因が考えられるかご教示よろしくお願い致します。

[code]

    $ yarn run android
    yarn run v1.9.4
    $ ENVFILE=.env.dev node node_modules/react-native/local-cli/cli.js run-android
    Scanning folders for symlinks in /Users/username/dev/react-native/asdo-app/node_modules (11ms)
    JS server already running.
    Building and installing the app on the device (cd android && ./gradlew installDebug)...
    
    \> Configure project :app
    WARNING: The option 'android.enableAapt2' is deprecated and should not be used anymore.
    Use 'android.enableAapt2=true' to remove this warning.
    It will be removed at the end of 2018..
    Reading env from: .env.dev
    WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
    It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
    WARNING: The specified Android SDK Build Tools version (27.0.2) is ignored, as it is below the minimum supported version (27.0.3) for Android Gradle Plugin 3.1.3.
    Android SDK Build Tools 27.0.3 will be used.
    To suppress this warning, remove "buildToolsVersion '27.0.2'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.
    
    \> Configure project :react-native-config
    WARNING: The option 'android.enableAapt2' is deprecated and should not be used anymore.
    Use 'android.enableAapt2=true' to remove this warning.
    It will be removed at the end of 2018..
    WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
    It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
    WARNING: The specified Android SDK Build Tools version (27.0.2) is ignored, as it is below the minimum supported version (27.0.3) for Android Gradle Plugin 3.1.3.
    Android SDK Build Tools 27.0.3 will be used.
    To suppress this warning, remove "buildToolsVersion '27.0.2'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.
    
    \> Configure project :react-native-device-info
    WARNING: The option 'android.enableAapt2' is deprecated and should not be used anymore.
    Use 'android.enableAapt2=true' to remove this warning.
    It will be removed at the end of 2018..
    WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
    It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
    WARNING: The specified Android SDK Build Tools version (27.0.2) is ignored, as it is below the minimum supported version (27.0.3) for Android Gradle Plugin 3.1.3.
    Android SDK Build Tools 27.0.3 will be used.
    To suppress this warning, remove "buildToolsVersion '27.0.2'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.
    
    \> Configure project :react-native-vector-icons
    WARNING: The option 'android.enableAapt2' is deprecated and should not be used anymore.
    Use 'android.enableAapt2=true' to remove this warning.
    It will be removed at the end of 2018..
    WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
    It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
    WARNING: The specified Android SDK Build Tools version (27.0.2) is ignored, as it is below the minimum supported version (27.0.3) for Android Gradle Plugin 3.1.3.
    Android SDK Build Tools 27.0.3 will be used.
    To suppress this warning, remove "buildToolsVersion '27.0.2'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.
    
    \> Task :app:installDebug
    Installing APK 'app-debug.apk' on 'Nexus_5X_API_24(AVD) - 7.0' for app:debug
    Installed on 1 device.
    
    
    BUILD SUCCESSFUL in 3s
    84 actionable tasks: 1 executed, 83 up-to-date
    Running /Users/username/Library/Android/sdk/platform-tools/adb -s emulator-5554 reverse tcp:8081 tcp:8081
    Starting the app on emulator-5554 (/Users/username/Library/Android/sdk/platform-tools/adb -s emulator-5554 shell am start -n com.test_app/com.test_app.MainActivity)...
    Starting: Intent { cmp=com.test_app/.MainActivity }
    Error type 3
    Error: Activity class {com.test_app/com.test_app.MainActivity} does not exist.
    ✨  Done in 5.41s.
    
[/code]


CC BY-SA 4.0
2018-09-12T05:11:09.167
48303
2023-11-16T01:06:30.770
2018-09-12T05:18:46.973
2238
29631
question
react-native
React Native で android アプリ起動しようとすると `Error type 3 Error: Activity class {} does not exist.` エラーが発生


以下の方法で解決できるかを試してみてください。  
1\. gradle.properties内のandroid.enableAapt2=falseを削除  
2\. build.gradle内のcompileをimplementationに置き換え  
3\. Update Build Tools version and sync projectを実行


CC BY-SA 4.0
2018-10-23T00:42:01.437
49548
2018-10-23T00:42:01.437
30605
48303
answer