簡體   English   中英

實驗gradle問題:android插件必須應用於項目

[英]Issue with experimental gradle: The android plugin must be applied to the project

我正在嘗試使用Android Studio中的NDK運行一些本機代碼。 我已按照此處顯示的步驟使用實驗Gradle,但顯然並非一切順利。 我收到此錯誤: The android or android-library plugin must be applied to the project
這是我的gradle文件:

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

model {
    android {
        compileSdkVersion = 22
        buildToolsVersion = "22.0.1"

        android.ndk {
            moduleName = "test"
        }

        defaultConfig.with {
            applicationId = "com.shaperstudio.dartboard"
            minSdkVersion.apiLevel = 15
            targetSdkVersion.apiLevel = 22
            versionCode = 1
            versionName = "1.0"
        }
    }
    android.buildTypes {
        release {
            minifyEnabled = false
            proguardFiles += file('proguard-rules.pro')
        }
    }
    packagingOptions {
        exclude = 'META-INF/services/javax.annotation.processing.Processor'
    }
}

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

    buildscript {
        repositories {
            jcenter()
            maven { url 'https://maven.fabric.io/public' }
        }
        dependencies {
            classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4'
            classpath 'io.fabric.tools:gradle:1.+'
        }
    }

    dependencies {
        compile fileTree(dir: 'libs', include: ['*.jar'])
        compile 'com.android.support:appcompat-v7:22.2.0'
        compile 'com.android.support:recyclerview-v7:22.2.0'
        compile 'com.android.support:design:22.2.0'
        compile 'com.jakewharton:butterknife:6.1.0'
        compile 'de.greenrobot:eventbus:2.4.0'
        apt 'com.bluelinelabs:logansquare-compiler:1.1.0'
        compile 'com.bluelinelabs:logansquare:1.1.0'
        compile 'com.birbit:android-priority-jobqueue:1.3'
        compile 'com.squareup.picasso:picasso:2.5.2'
        compile 'com.facebook.android:facebook-android-sdk:4.1.0'
        compile 'com.parse.bolts:bolts-android:1.+'
        compile fileTree(dir: 'libs', include: '*.jar')
        compile('com.crashlytics.sdk.android:crashlytics:2.4.0@aar') {
            transitive = true;
        }
    }

任何幫助,為什么我得到這個錯誤將不勝感激

嘗試使用此插件

https://bitbucket.org/pvoid/android-apt-experemental/overview

而不是android-apt

幾周前我遇到了這個問題。 com.neenbedankt.android-apt插件需要android或android-library插件。

我給apt插件作者https://bitbucket.org/hvisser/android-apt寫了一封信。

你好! 谷歌幾天前宣布推出jni支持的android studio預覽版1.3。 為此,他們使用插件com.android.model.application(classpath“com.android.tools.build:gradle-experimental:0.1.0”)。 它與您的插件不兼容。 我試着做自己的分叉,但我不擅長插件開發。 你打算支持新的插件嗎?

回答。

不是在短期內,因為所需的鈎子仍然缺失,看起來它將是一個重寫,因為很多已經改變。 您應該能夠使用實驗插件為NDK創建單獨的模塊,並使用stable插件為所有其他Android內容創建另一個模塊。

我也嘗試自己創建android-apt的分支,但我不是一個gradle guru,我沒有足夠的時間。

所以你應該只為NDK創建單獨的模塊(例如計算某些東西)。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM