Gradle构建错误:"找不到id为'com.google.ar.sceneform.plugin'的插件。"

9

我正在按照这个Sceneform SDK教程(https://www.raywenderlich.com/5485-arcore-sceneform-sdk-getting-started)进行操作,但在构建Gradle时遇到了一些问题。以下是我的应用程序build.gradle文件:

apply plugin: 'com.android.application'

apply plugin: 'kotlin-android'

apply plugin: 'kotlin-android-extensions'


android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.example.kotlinfirstapp"
        minSdkVersion 24
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'


    implementation 'com.google.ar.ar:core:1.10.0'
    implementation 'com.google.ar.sceneform.ux:sceneform-ux:1.10.0'
    implementation 'com.google.ar.sceneform:core:1.10.0'
}

apply plugin: 'com.google.ar.sceneform.plugin'

sceneform.asset('sampledata/models/andy.obj',
        'default',
        'sampledata/models/andy.sfa',
        'src/main/res/raw/andy')

输出显示以下错误:
Plugin with id 'com.google.ar.sceneform.plugin' not found.
2个回答

25

您在build.gradle(Project)文件中缺少classpath:

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

buildscript {
    repositories {
        google()
        jcenter()

}
dependencies {
    classpath 'com.android.tools.build:gradle:3.4.1'        
    classpath 'com.google.ar.sceneform:plugin:1.10.0'

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

0
假设您的Android版本为3.6.x。最新的Sceneform SDK 1.15+不支持Android版本3.6.x。已经提出了错误,但目前还没有解决方案!您可以做的是切换到Android版本3.5.3并使用Sceneform SDK 1.15.0。这样做将帮助您摆脱面临的问题。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接