Gradle Bulid не удалось с java.lang.NullPointerException после добавления реагировать родной в существующий проект Android - PullRequest
0 голосов
/ 01 ноября 2019

Я пытаюсь настроить React Native в существующий проект, но сборка gradle завершилась с ошибкой компиляции e: [kapt] Возникла исключительная ситуация: java.lang.NullPointerException

Вот мой проект / build.gradle

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

buildscript {
    ext.kotlin_version = '1.3.21'
    ext.anko_version = '0.10.1'
    ext.android_arch_comp_lifecycle_runtime_version = '1.0.3'
    ext.android_arch_comp_lifecycle_compiler_version = '1.0.0'
    ext.android_arch_comp_lifecycle_extensions_version = '1.0.0'
    ext.android_support_lib_version = '28.1.0'
    ext.dagger_2_version = '2.11'
    ext.reprint_version = '3.1.0'
    ext.gson_version = '2.8.1'
    ext.ok_http_version = '3.8.1'
    ext.retrofit_2_version = '2.3.0'
    ext.gradle_plugin_version = '3.3.1'

    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath "com.android.tools.build:gradle:$gradle_plugin_version"
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

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

apply plugin: 'kotlin'

allprojects {
    repositories {
        google()
        jcenter()
        maven { url 'https://maven.google.com' }
        maven { url "https://jitpack.io" }
        // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
        maven { url "$rootDir/../node_modules/react-native/android" }

        maven { url "$rootDir/../node_modules/@bsw/jitsi-meet/android" }
        maven { url "$rootDir/../node_modules/jsc-android/dist" }
    }
}

subprojects {

    afterEvaluate { project ->
        if (!project.name.equalsIgnoreCase("app")
                && project.hasProperty("android")) {
            android {
                compileSdkVersion "$android_compile_sdk_version".toInteger()
                buildToolsVersion "$android_build_tools_version"
                defaultConfig {
                    minSdkVersion "$android_min_sdk_version".toInteger()
                    targetSdkVersion "$android_compile_sdk_version".toInteger()
                }
            }
        }
    }

}
repositories {
    mavenCentral()
}
dependencies {
    compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
    implementation 'org.jetbrains:annotations:15.0'
}
compileKotlin {
    kotlinOptions {
        jvmTarget = "1.8"
    }
}
compileTestKotlin {
    kotlinOptions {
        jvmTarget = "1.8"
    }
}

и мое приложение / build.gradle

buildscript {

    ext.include_react_native_bundle_flag = true
    ext.exclude_react_native_bundle_flag = false

    repositories {
        maven { url 'https://maven.google.com' }
    }


}

project.ext.react = [
        entryFile: "index.js",
        enableHermes: false,  // clean and rebuild if changing
]

apply plugin: "com.android.application"
apply plugin: 'kotlin-android'

apply plugin: 'kotlin-android-extensions'

apply plugin: 'kotlin-kapt'

apply from: "../../node_modules/react-native/react.gradle"

import com.android.build.OutputFile




android {
    compileSdkVersion 28
    buildToolsVersion "28.0.3"
    defaultConfig {
        applicationId "com.baylorscottandwhite.informus.mybsw_droid"
        minSdkVersion 19
        targetSdkVersion 28
        versionCode 2
        versionName "1.1"
        vectorDrawables.useSupportLibrary = true
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }

    signingConfigs {
        debug {
            storeFile file('debug.keystore')
            storePassword 'android'
            keyAlias 'androiddebugkey'
            keyPassword 'android'
        }
    }

    buildTypes {
        debug {
            debuggable true
            multiDexEnabled true
            signingConfig signingConfigs.debug
        }
        release {
            // Caution! In production, you need to generate your own keystore file.
            // see https://facebook.github.io/react-native/docs/signed-apk-android.
            signingConfig signingConfigs.debug
            multiDexEnabled true
            minifyEnabled false
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
        }
        buildTypes.each {
            it.buildConfigField 'String', 'API_AUTH_GRANT_TYPE_PWD', '"password"'
            it.buildConfigField 'String', 'API_AUTH_GRANT_TYPE_REFRESH', '"refresh_token"'
            it.buildConfigField 'int', 'API_DEFAULT_PORT', '80'
            it.buildConfigField 'int', 'API_CONNECTIVITY_TIMEOUT', '5000' //in milliseconds
            it.buildConfigField 'int', 'API_READ_TIMEOUT', '30000' //in milliseconds
        }
        applicationVariants.all { variant ->
            variant.outputs.each { output ->
                // For each separate APK per architecture, set a unique version code as described here:
                // https://developer.android.com/studio/build/configure-apk-splits.html
                def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
                def abi = output.getFilter(OutputFile.ABI)
                def outputFile = output.outputFile
                if (outputFile != null && outputFile.name.endsWith('.aar')) {
                    def fileName = "${archivesBaseName}-${version}-${variant.buildType.name}.aar"
                    output.outputFile = new File(outputFile.parent, fileName)
                }
                if (abi != null) {  // null for the universal-debug, universal-release variants
                    output.versionCodeOverride =
                            versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
                }

            }
        }
    }

    android {
        dataBinding {
            enabled = true
        }
    }
    android {
        compileOptions {
            sourceCompatibility JavaVersion.VERSION_1_8
            targetCompatibility JavaVersion.VERSION_1_8
        }
    }


}



dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
    implementation 'org.jetbrains:annotations:15.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation('com.android.support.test:runner:1.0') {
        exclude group: 'com.android.support'

    }

    androidTestImplementation("com.android.support.test.espresso:espresso-intents:3.0.0") {
        exclude group: 'com.android.support'
        exclude group: 'com.google.code.findbugs'
        exclude module: 'support-annotations'
    }

    //Android Support Library
    implementation "com.android.support:appcompat-v7:28.0.0"
    implementation "com.android.support:design:28.0.0"
    implementation "com.android.support:support-v4:28.0.0"
    implementation "com.android.support:recyclerview-v7:28.0.0"
    implementation "com.android.support:cardview-v7:28.0.0"
    implementation 'androidx.core:core:1.1.0-rc03'
    implementation ('androidx.constraintlayout:constraintlayout:2.0.0-beta2') {
        exclude group: "androidx.core.core"
    }
    // implementation "com.android.support.constraint:constraint-layout:1.0.2"
    implementation "com.android.support:support-annotations:28.0.0"
    implementation "com.android.support:preference-v14:28.0.0"
    implementation "com.android.support:gridlayout-v7:28.0.0"

    //MaterialDialogs
    implementation "com.afollestad.material-dialogs:core:0.9.4.5"

    //ReactNative
//    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation "com.facebook.react:react-native:+"  // From node_modules

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

    //Anko Commons & Coroutines
    implementation "org.jetbrains.anko:anko-common:$anko_version"
    implementation "org.jetbrains.anko:anko-coroutines:$anko_version"

    //Timber - wrapper for logging
    implementation 'com.github.ajalt:timberkt:1.3.0'

    //Android Architecture Components
    implementation "android.arch.lifecycle:runtime:$android_arch_comp_lifecycle_runtime_version"
    implementation "android.arch.lifecycle:extensions:$android_arch_comp_lifecycle_extensions_version"
    kapt "android.arch.lifecycle:compiler:$android_arch_comp_lifecycle_compiler_version"

    //Android Data Binding Library
    kapt "com.android.databinding:compiler:3.1.4"
   // annotationProcessor 'com.android.databinding:compiler:3.1.4'




    implementation ('com.github.bumptech.glide:glide:4.7.1') {
        exclude group: "com.android.support"
    }
    kapt 'com.github.bumptech.glide:compiler:4.7.1'

//   annotationProcessor 'androidx.annotation:annotation:1.0.0'
//   annotationProcessor 'com.github.bumptech.glide:compiler:4.8.0'

    //Dagger2
    //implementation "com.google.dagger:dagger:$dagger_2_version"
    // kapt "com.google.dagger:dagger-compiler:$dagger_2_version"
//    implementation 'com.google.dagger:dagger:2.11-rc2'
//    kapt 'com.google.dagger:dagger-compiler:2.11-rc2'
//    implementation 'com.google.dagger:dagger-android-support:2.11-rc2'
//    annotationProcessor 'com.google.dagger:dagger-android-processor:2.11'
    compile 'com.google.dagger:dagger:2.13'
    kapt 'com.google.dagger:dagger-compiler:2.13'

    //Reprint Core & Samsung Legacy Fingerprint Support
    implementation "com.github.ajalt.reprint:core:$reprint_version@aar"
    implementation "com.github.ajalt.reprint:reprint_spass:$reprint_version@aar"

    //Secure Preferences Storage
    implementation "online.devliving:securedpreferencestore:0.4.1"

    //Gson
    implementation group: 'com.google.code.gson', name: 'gson', version: "$gson_version"

    //Force OkHttp3 to avoid Espresso conflicts
    implementation("com.squareup.okhttp3:okhttp:$ok_http_version") {
        force = true
    }

    // Logging interceptor for okhttp/retrofit logging of request/responses
    implementation "com.squareup.okhttp3:logging-interceptor:$ok_http_version"

    //Retrofit
    implementation "com.squareup.retrofit2:retrofit:$retrofit_2_version"
    implementation "com.squareup.retrofit2:converter-gson:$retrofit_2_version"

}

task copyDownloadableDepsToLibs(type: Copy) {
    from configurations.compile
    into 'libs'
}

// for 1.14 features 1) synthetics in ViewHolder (etc) and 2) @Parcelize
androidExtensions {
    experimental = true
}

repositories {
    mavenCentral()
    jcenter()
}


//kapt {
//    generateStubs = false
//}
kapt {
    javacOptions {
        // Increase the max count of errors from annotation processors.
        // Default is 100.
        option("-Xmaxerrs", 500)
    }
}
//kapt {
//    correctErrorTypes true
//}


kotlin {
    experimental {
        coroutines 'enable'
    }
}
//task modifyReactNativeConfig(type: Exec) {
//    println 'Modify remote config files.'
//    commandLine 'bash', '-c', '../../tools/appconfig.sh --platform android'
//}
//preBuild.dependsOn modifyReactNativeConfig

gradle.properties

org.gradle.jvmargs=-Xmx1536m
android.databinding.enableV2=false
android.enableExperimentalFeatureDatabinding = false
org.gradle.daemon=true
org.gradle.parallel=false
org.gradle.configureondemand=false

при попытке запустить сборку приложения с сообщением eroor

e: [kapt] Возникла исключительная ситуация: java.lang.NullPointerException

, пожалуйста, помогите мне решить эту ошибку

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...