Реагировать на собственный 'yarn android' не удалось с 'Task: app: compileDebugJavaWith Javac FAILED' и 'package org.unimodules.core.interfaces не существует' - PullRequest
0 голосов
/ 14 апреля 2020

Это две основные ошибки, которые я могу заметить из вывода консоли

Task :app:compileDebugJavaWithJavac FAILED
package org.unimodules.core.interfaces does not exist

Я работаю yarn android с моим HT C Один M8 на Marshmellow подключен и получает следующее

    yarn run v1.22.4
    $ react-native run-android
    error React Native CLI uses autolinking for native dependencies, but the following modules are linked manually: 
      - react-native-share (to unlink run: "react-native unlink react-native-share")
    This is likely happening when upgrading React Native from below 0.60 to 0.60 or above. Going forward, you can unlink this dependency via "react-native unlink <dependency>" and it will be included in your app automatically. If a library isn't compatible with autolinking, disregard this message and notify the library maintainers.
    Read more about autolinking: https://github.com/react-native-community/cli/blob/master/docs/autolinking.md
    info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
    Jetifier found 1460 file(s) to forward-jetify. Using 4 workers...
    info JS server already running.
    info Installing the app...
    Starting a Gradle Daemon, 1 incompatible and 6 stopped Daemons could not be reused, use --status for details
    
    > Task :app:compileDebugJavaWithJavac
    
    > Task :app:compileDebugJavaWithJavac FAILED
    101 actionable tasks: 2 executed, 99 up-to-date
    /MyApp/android/app/src/main/java/com/sealsounds/generated/BasePackageList.java:5: error: 
    package org.unimodules.core.interfaces does not exist
    import org.unimodules.core.interfaces.Package;
                                         ^
    /MyApp/android/app/src/main/java/com/sealsounds/MainApplication.java:13: error: package o
    rg.unimodules.adapters.react does not exist
    import org.unimodules.adapters.react.ReactAdapterPackage;
                                        ^
    /MyApp/android/app/src/main/java/com/sealsounds/MainApplication.java:14: error: package org.unimodules.adapters.react does not exist
    import org.unimodules.adapters.react.ModuleRegistryAdapter;
                                        ^
    /MyApp/android/app/src/main/java/com/sealsounds/MainApplication.java:15: error: package org.unimodules.adapters.react does not exist
    import org.unimodules.adapters.react.ReactModuleRegistryProvider;
                                        ^
    /MyApp/android/app/src/main/java/com/sealsounds/MainApplication.java:16: error: package org.unimodules.core.interfaces does not exist
    import org.unimodules.core.interfaces.Package;
                                         ^
    /MyApp/android/app/src/main/java/com/sealsounds/MainApplication.java:17: error: package org.unimodules.core.interfaces does not exist
    import org.unimodules.core.interfaces.SingletonModule;
                                         ^
    /MyApp/android/app/src/main/java/com/sealsounds/MainApplication.java:18: error: package expo.modules.constants does not exist
    import expo.modules.constants.ConstantsPackage;
                                 ^
    /MyApp/android/app/src/main/java/com/sealsounds/MainApplication.java:19: error: package expo.modules.permissions does not exist
    import expo.modules.permissions.PermissionsPackage;
                                   ^
    /MyApp/android/app/src/main/java/com/sealsounds/MainApplication.java:20: error: package expo.modules.filesystem does not exist
    import expo.modules.filesystem.FileSystemPackage;
                                  ^
    /MyApp/android/app/src/main/java/com/sealsounds/MainApplication.java:32: error: cannot find symbol
      private final ReactModuleRegistryProvider mModuleRegistryProvider = new ReactModuleRegistryProvider(
                    ^
      symbol:   class ReactModuleRegistryProvider
      location: class MainApplication
    /MyApp/android/app/src/main/java/com/sealsounds/generated/BasePackageList.java:10: error: package expo.modules.constants does not exist
            new expo.modules.constants.ConstantsPackage(),
                                      ^
    /MyApp/android/app/src/main/java/com/sealsounds/generated/BasePackageList.java:11: error: package expo.modules.errorrecovery does not exist
            new expo.modules.errorrecovery.ErrorRecoveryPackage(),
                                          ^
    /MyApp/android/app/src/main/java/com/sealsounds/generated/BasePackageList.java:12: error: package expo.modules.filesystem does not exist
            new expo.modules.filesystem.FileSystemPackage(),
                                       ^
    /MyApp/android/app/src/main/java/com/sealsounds/generated/BasePackageList.java:13: error: package expo.modules.font does not exist
            new expo.modules.font.FontLoaderPackage(),
                                 ^
    /MyApp/android/app/src/main/java/com/sealsounds/generated/BasePackageList.java:14: error: package expo.modules.keepawake does not exist
            new expo.modules.keepawake.KeepAwakePackage(),
                                      ^
    /MyApp/android/app/src/main/java/com/sealsounds/generated/BasePackageList.java:15: error: package expo.modules.lineargradient does not exist
            new expo.modules.lineargradient.LinearGradientPackage(),
                                           ^
    /MyApp/android/app/src/main/java/com/sealsounds/generated/BasePackageList.java:16: error: package expo.modules.location does not exist
            new expo.modules.location.LocationPackage(),
                                     ^
    /MyApp/android/app/src/main/java/com/sealsounds/generated/BasePackageList.java:17: error: package expo.modules.permissions does not exist
            new expo.modules.permissions.PermissionsPackage(),
                                        ^
    /MyApp/android/app/src/main/java/com/sealsounds/generated/BasePackageList.java:18: error: package expo.modules.sqlite does not exist
            new expo.modules.sqlite.SQLitePackage(),
                                   ^
    /MyApp/android/app/src/main/java/com/sealsounds/generated/BasePackageList.java:19: error: package expo.modules.webbrowser does not exist
            new expo.modules.webbrowser.WebBrowserPackage()
                                       ^
    /MyApp/android/app/src/main/java/com/sealsounds/MainApplication.java:32: error: cannot find symbol
      private final ReactModuleRegistryProvider mModuleRegistryProvider = new ReactModuleRegistryProvider(
                                                                              ^
      symbol:   class ReactModuleRegistryProvider
      location: class MainApplication
    /MyApp/android/app/src/main/java/com/sealsounds/MainApplication.java:34: error: cannot find symbol
        Arrays.<SingletonModule>asList()
                ^
      symbol:   class SingletonModule
      location: class MainApplication
    /MyApp/android/app/src/main/java/com/sealsounds/MainApplication.java:47: error: cannot find symbol
            new ModuleRegistryAdapter(mModuleRegistryProvider)
                ^
      symbol: class ModuleRegistryAdapter
    23 errors
    
    FAILURE: Build failed with an exception.
    
    * What went wrong:
    Execution failed for task ':app:compileDebugJavaWithJavac'.
    > Compilation failed; see the compiler error output for details.
    
    * Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
    
    * Get more help at https://help.gradle.org
    
    BUILD FAILED in 1m 13s
    
    error Failed to install the app. Make sure you have the Android development environment set up: https://facebook.github.io/react-native/docs/getting-started.html#android-development-environment. Run CLI with --verbose flag for more details.
    Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
    /MyApp/android/app/src/main/java/com/sealsounds/generated/BasePackageList.java:5: error: package org.unimodules.core.interfaces does not exist
    import org.unimodules.core.interfaces.Package;
                                         ^
    /MyApp/android/app/src/main/java/com/sealsounds/MainApplication.java:13: error: package org.unimodules.adapters.react does not exist
    import org.unimodules.adapters.react.ReactAdapterPackage;
                                        ^
    /MyApp/android/app/src/main/java/com/sealsounds/MainApplication.java:14: error: package org.unimodules.adapters.react does not exist
    import org.unimodules.adapters.react.ModuleRegistryAdapter;
                                        ^
    /MyApp/android/app/src/main/java/com/sealsounds/MainApplication.java:15: error: package org.unimodules.adapters.react does not exist
    import org.unimodules.adapters.react.ReactModuleRegistryProvider;
                                        ^
    /MyApp/android/app/src/main/java/com/sealsounds/MainApplication.java:16: error: package org.unimodules.core.interfaces does not exist
    import org.unimodules.core.interfaces.Package;
                                         ^
    /MyApp/android/app/src/main/java/com/sealsounds/MainApplication.java:17: error: package org.unimodules.core.interfaces does not exist
    import org.unimodules.core.interfaces.SingletonModule;
                                         ^
    /MyApp/android/app/src/main/java/com/sealsounds/MainApplication.java:18: error: package expo.modules.constants does not exist
    import expo.modules.constants.ConstantsPackage;
                                 ^
    /MyApp/android/app/src/main/java/com/sealsounds/MainApplication.java:19: error: package expo.modules.permissions does not exist
    import expo.modules.permissions.PermissionsPackage;
                                   ^
    /MyApp/android/app/src/main/java/com/sealsounds/MainApplication.java:20: error: package expo.modules.filesystem does not exist
    import expo.modules.filesystem.FileSystemPackage;
                                  ^
    /MyApp/android/app/src/main/java/com/sealsounds/MainApplication.java:32: error: cannot find symbol
      private final ReactModuleRegistryProvider mModuleRegistryProvider = new ReactModuleRegistryProvider(
                    ^
      symbol:   class ReactModuleRegistryProvider
      location: class MainApplication
    /MyApp/android/app/src/main/java/com/sealsounds/generated/BasePackageList.java:10: error: package expo.modules.constants does not exist
            new expo.modules.constants.ConstantsPackage(),
                                      ^
    /MyApp/android/app/src/main/java/com/sealsounds/generated/BasePackageList.java:11: error: package expo.modules.errorrecovery does not exist
            new expo.modules.errorrecovery.ErrorRecoveryPackage(),
                                          ^
    /MyApp/android/app/src/main/java/com/sealsounds/generated/BasePackageList.java:12: error: package expo.modules.filesystem does not exist
            new expo.modules.filesystem.FileSystemPackage(),
                                       ^
    /MyApp/android/app/src/main/java/com/sealsounds/generated/BasePackageList.java:13: error: package expo.modules.font does not exist
            new expo.modules.font.FontLoaderPackage(),
                                 ^
    /MyApp/android/app/src/main/java/com/sealsounds/generated/BasePackageList.java:14: error: package expo.modules.keepawake does not exist
            new expo.modules.keepawake.KeepAwakePackage(),
                                      ^
    /MyApp/android/app/src/main/java/com/sealsounds/generated/BasePackageList.java:15: error: package expo.modules.lineargradient does not exist
            new expo.modules.lineargradient.LinearGradientPackage(),
                                           ^
    /MyApp/android/app/src/main/java/com/sealsounds/generated/BasePackageList.java:16: error: package expo.modules.location does not exist
            new expo.modules.location.LocationPackage(),
                                     ^
    /MyApp/android/app/src/main/java/com/sealsounds/generated/BasePackageList.java:17: error: package expo.modules.permissions does not exist
            new expo.modules.permissions.PermissionsPackage(),
                                        ^
    /MyApp/android/app/src/main/java/com/sealsounds/generated/BasePackageList.java:18: error: package expo.modules.sqlite does not exist
            new expo.modules.sqlite.SQLitePackage(),
                                   ^
    /MyApp/android/app/src/main/java/com/sealsounds/generated/BasePackageList.java:19: error: package expo.modules.webbrowser does not exist
            new expo.modules.webbrowser.WebBrowserPackage()
                                       ^
    /MyApp/android/app/src/main/java/com/sealsounds/MainApplication.java:32: error: cannot find symbol
      private final ReactModuleRegistryProvider mModuleRegistryProvider = new ReactModuleRegistryProvider(
                                                                              ^
      symbol:   class ReactModuleRegistryProvider
      location: class MainApplication
    /MyApp/android/app/src/main/java/com/sealsounds/MainApplication.java:34: error: cannot find symbol
        Arrays.<SingletonModule>asList()
                ^
      symbol:   class SingletonModule
      location: class MainApplication
    /MyApp/android/app/src/main/java/com/sealsounds/MainApplication.java:47: error: cannot find symbol
            new ModuleRegistryAdapter(mModuleRegistryProvider)
                ^
      symbol: class ModuleRegistryAdapter
    23 errors
    
    FAILURE: Build failed with an exception.
    
    * What went wrong:
    Execution failed for task ':app:compileDebugJavaWithJavac'.
    > Compilation failed; see the compiler error output for details.
    
    * Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
    
    * Get more help at https://help.gradle.org
    
    BUILD FAILED in 1m 13s
    
        at checkExecSyncError (child_process.js:610:11)
        at execFileSync (child_process.js:628:15)
        at runOnAllDevices (/MyApp/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:94:39)
        at buildAndRun (/MyApp/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/index.js:179:41)
        at /MyApp/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/index.js:133:12
        at processTicksAndRejections (internal/process/task_queues.js:97:5)
        at async Command.handleAction (/MyApp/node_modules/@react-native-community/cli/build/index.js:182:9)
    error Command failed with exit code 1.
    info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Неудачные попытки

Я пытался

./gradlew clean

rm ~/.gradle

Invalidate Caches
Close android studio
rm android/.gradle
open android studio

rm android/.idea

LogCat

Мой LogCat в android studio также просто постоянно печатает, как показано ниже, снова и снова

04-13 16:49:26.922 22701-22740/com.firebasechat D/libc: [NET] android_getaddrinfo_proxy+
04-13 16:49:26.923 22701-22740/com.firebasechat D/libc: [NET] android_getaddrinfo_proxy get netid:0
04-13 16:49:26.925 455-5007/? D/libc: [NET] android_getaddrinfofornetcontext+,hn 9(0x6c6f63616c686f),sn(),hints(known),family 0,flags 1024, proc=/system/bin/netd
04-13 16:49:26.925 455-5007/? D/libc: [NET] android_getaddrinfo_proxy+
04-13 16:49:26.926 455-5007/? D/libc: [NET] android_getaddrinfo_proxy-, fd error: Success(0)
04-13 16:49:26.930 22701-22740/com.firebasechat D/libc: [NET] android_getaddrinfo_proxy-, success
04-13 16:49:27.497 24052-24054/? E/nightwatch-watcher: Failed to read from logcat: Success
04-13 16:49:28.189 3162-3550/? I/bt_hci: BLE HCI(id=62) event = 0x02)
04-13 16:49:28.189 3162-3550/? I/bt_hci: btu_ble_process_adv_pkt
04-13 16:49:28.190 3162-3550/? I/bt_btm: btm_identity_addr_to_random_pseudo
04-13 16:49:28.190 3162-3550/? D/bt_btm: btm_ble_process_adv_pkt:bda= 5c:49:7d:65:45:37
04-13 16:49:28.190 3162-3550/? I/bt_btm: btm_ble_resolve_random_addr
04-13 16:49:28.190 3162-3550/? D/bt_btm: sec_flags = 00 device_type = 0
04-13 16:49:28.190 3162-3550/? D/bt_btm: sec_flags = 00 device_type = 0
  

Журнал событий

Это также отображается в моем журнале событий в android studio

Unsupported Modules Detected: Compilation is not supported for following modules: android. Unfortunately you can't have non-Gradle Java modules and Android-Gradle modules in one project.

build.gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    ext {
        buildToolsVersion = "28.0.3"
        minSdkVersion = 21
        compileSdkVersion = 28
        targetSdkVersion = 28
        supportLibVersion = "28.0.0"
    }
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.5.3'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        mavenLocal()
        google()
        jcenter()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url "$rootDir/../node_modules/react-native/android"
        }
        maven {
            // Android JSC is installed from npm
            url("$rootDir/../node_modules/jsc-android/dist")
        }
    }
}


wrapper {
    gradleVersion = '4.7'
    distributionUrl = distributionUrl.replace("bin", "all")
}

app / build.gradle

apply plugin: "com.android.application"
import com.android.build.OutputFile

project.ext.react = [
    entryFile: "index.js",
    enableHermes: false
]

apply from: '../../node_modules/react-native-unimodules/gradle.groovy'
apply from: "../../node_modules/react-native/react.gradle"

/**
 * Set this to true to create two separate APKs instead of one:
 *   - An APK that only works on ARM devices
 *   - An APK that only works on x86 devices
 * The advantage is the size of the APK is reduced by about 4MB.
 * Upload all the APKs to the Play Store and people will download
 * the correct one based on the CPU architecture of their device.
 */
def enableSeparateBuildPerCPUArchitecture = false

/**
 * Run Proguard to shrink the Java bytecode in release builds.
 */
def enableProguardInReleaseBuilds = false

android {
    compileSdkVersion rootProject.ext.compileSdkVersion
    buildToolsVersion rootProject.ext.buildToolsVersion

    defaultConfig {
        applicationId "com.me.myAppId"
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode 12
        versionName "1.2"
    }
    signingConfigs {
        release {
            //if (project.hasProperty('my-upload-key.keystore')) {
                storeFile file("SealSounds.jks")
                storePassword "73bd767afc2a499aa13f38588a1b35a6"
                keyAlias "QHNhbWdlcm1haW4vU2VhbFNvdW5kcw=="
                keyPassword "40bb1aec85b44217963a48ace82b3caa"
            //}
        }
    }
    splits {
        abi {
            reset()
            enable enableSeparateBuildPerCPUArchitecture
            universalApk false  // If true, also generate a universal APK
            include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
        }
    }
    buildTypes {
        release {
            minifyEnabled enableProguardInReleaseBuilds
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
            signingConfig signingConfigs.release
        }
    }
    // applicationVariants are e.g. debug, release
    applicationVariants.all { variant ->
        variant.outputs.each { output ->
            // For each separate APK per architecture, set a unique version code as described here:
            // http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
            def versionCodes = ["armeabi-v7a":1, "x86":2, "arm64-v8a": 3, "x86_64": 4]
            def abi = output.getFilter(OutputFile.ABI)
            if (abi != null) {  // null for the universal-debug, universal-release variants
                output.versionCodeOverride =
                        versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
            }
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

def jscFlavor = 'org.webkit:android-jsc:+'

def enableHermes = project.ext.react.get("enableHermes", false);

dependencies {
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
    implementation "com.facebook.react:react-native:+"  // From node_modules
    // implementation project(':react-native-share')
//    compile project(':react-native-spring-scrollview')
//    addUnimodulesDependencies()

    if (enableHermes) {
        def hermesPath = "../../node_modules/hermes-engine/android/";
        debugImplementation files(hermesPath + "hermes-debug.aar")
        releaseImplementation files(hermesPath + "hermes-release.aar")
    } else {
        implementation jscFlavor
    }
}

// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
    from configurations.compile
    into 'libs'
}

apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle");
applyNativeModulesAppBuildGradle(project)
...