Chaquo. python не удалось установить в Android Studio - PullRequest
1 голос
/ 27 марта 2020

Я пытаюсь использовать Python в своем приложении Android. Я обновил файлы gradle для файла приложения и проекта, как показано ниже:

build.gradle (: app) файл выглядит следующим образом

apply plugin: 'com.android.application'
apply plugin: 'com.chaquo.python'

android {
    compileSdkVersion 29
    buildToolsVersion "29.0.3"
    defaultConfig {
        ndk {
            abiFilters "armeabi-v7a", "x86"
        }
        applicationId "com.example.finalone"
        sourceSets{
        }
        minSdkVersion 16
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        python{
            buildPython "/home/anaconda3/bin/python3.7"
            buildPython "py -3.7"
        }
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}
dependencies {
    // we should add .jar extension too for AAR files
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test.ext:junit:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
    implementation 'org.tensorflow:tensorflow-android:1.4.0'
}

и build.gradle (MyProject) выглядит следующим образом

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

buildscript {

    repositories {
        google()
        maven { url "https://chaquo.com/maven" }
        jcenter()

    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.6.1'
        //implementation'org.tensorflow:tensorflow-android:+'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
        classpath "com.chaquo.python:gradle:7.0.2"
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        maven{
            url 'https://maven.google.com/'
            name 'Google'
        }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

Когда я пытаюсь установить приложение в своем телефоне, я получаю эту ошибку:

Возникла проблема при оценке проекта ': app'.

Не удалось применить плагин [id 'com.chaquo. python'] Нет такого свойства: dslScope для класса:> com. android .build.gradle.internal.api.DefaultAndroidSourceDirectorySet

Что-то мне не хватает, я использую правила с этого сайта https://chaquo.com/chaquopy/doc/current/android.html

...