当我在gradle中添加CMake路径时,构建过程陷入StackOverflowError

时间:2017-10-18 08:21:41

标签: android gradle cmake android-ndk

我正在尝试实施这种方法 - https://www.androidsecurity.info/2016/12/15/storing-your-secure-information-in-the-ndk/

我在gradle文件中添加cmake路径的那一刻,

externalNativeBuild {
    cmake {
        path 'src/CMakeLists.txt'
    }
}

构建过程陷入StackOverflowError。

enter image description here _

请注意。如果我在一个新项目中实现该方法,一切正常 - gradle构建成功,本机方法在java类中工作。当我在具有许多依赖项的“生产”项目中执行相同操作时,会出现问题。

你可以看到gradle卡在“解决工件uiautomator-v18.aar”上。从依赖项中删除“uiautomator”时,会出现相同的错误但是使用“espresso-core”,删除“espresso-core” - “hamcrest-library”是下一个,依此类推。

所有模块build.gradle文件:

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'io.fabric'
apply plugin: 'com.neenbedankt.android-apt'

apply plugin: 'kotlin-android-extensions'
androidExtensions {
    experimental = true
}

buildscript {
    repositories {
        maven { url 'https://maven.fabric.io/public' }
    }

    dependencies {
        repositories {
            jcenter()
        }

        classpath 'com.android.tools.build:gradle:2.2.2'
        classpath 'io.fabric.tools:gradle:1.21.4'
    }
}

repositories {
    maven { url 'https://maven.fabric.io/public' }
    mavenCentral()
}

android {

    lintOptions {
        // google services plugin is causing missing translation issue
        abortOnError false
        disable 'MissingTranslation'
    }

    compileSdkVersion rootProject.ext.compileSdkVersion
    buildToolsVersion rootProject.ext.toolsVersion

    signingConfigs { ... }

    defaultConfig {
        applicationId "..."
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion

        buildConfigField "boolean", "USE_ANALYTIC", "false"
        buildConfigField 'boolean', 'USE_TRANSLATION', 'false'
        vectorDrawables.useSupportLibrary = true
        multiDexEnabled true
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }

    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            buildConfigField "boolean", "USE_ANALYTIC", "true"
            signingConfig signingConfigs.release
        }

        debug {
            minifyEnabled false
            debuggable true
            buildConfigField "boolean", "USE_ANALYTIC", "false"
        }
    }

    productFlavors {...}

    externalNativeBuild {
        cmake {
            path 'src/CMakeLists.txt'
        }
    }

    dataBinding { enabled = true }
}

configurations { ... }
dependencies {
    ...
    // debug tools
    compile('com.crashlytics.sdk.android:crashlytics:2.5.5@aar') {
        transitive = true;
    }

    compile rootProject.deps.firebaseMessaging
    compile rootProject.deps.firebaseCore
    compile rootProject.deps.firebaseConfig

    compile 'com.squareup.picasso:picasso:2.5.2'
    compile('com.mcxiaoke.viewpagerindicator:library:2.4.1') {
        exclude module: 'support-v4';
    }
    compile "com.android.support:support-vector-drawable:$supportLibrary"
    compile "com.android.support:animated-vector-drawable:$supportLibrary"
    compile rootProject.deps.appCompat
    compile rootProject.deps.cardView
    compile rootProject.deps.design
    compile project(':sublimepickerlibrary')
    compile project(':segmentedcontrol')
    compile project(':stickyheaderlist')
    compile "com.android.support:customtabs:$supportLibrary"
    apt rootProject.deps.daggerCompiler

    testCompile rootProject.testDeps.junit
    testCompile rootProject.testDeps.intellijannotations
    testCompile rootProject.testDeps.mockito
    testCompile rootProject.testDeps.mockitoKotlin

    androidTestCompile "com.android.support:support-annotations:$supportLibrary"
    androidTestCompile 'com.android.support.test:runner:0.5'
    androidTestCompile 'com.android.support.test:rules:0.5'
    androidTestCompile 'org.hamcrest:hamcrest-library:1.3'
    androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2'
    androidTestCompile 'com.android.support.test.uiautomator:uiautomator-v18:2.1.2'

    compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
    compile 'com.artemzin.rxjava:proguard-rules:1.0.14.2'

    compile rootProject.deps.rxAndroid
    compile rootProject.deps.rxJava
}

configurations.all {
    resolutionStrategy {
        force "org.mockito:mockito-core:$mockito",
                "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
    }
}

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
    }
}

apply plugin: 'com.google.gms.google-services'

感谢任何帮助 - 直接回答或至少指出研究的地方。

0 个答案:

没有答案