Вы установили местоположение JDK в Структуре проекта -> Местоположение JDK?

аюсь создать настраиваемый AOSP (на Android M, API 23) с помощью Android Studio, потому что я хочу запускать инструментальные тесты для пользовательских приложений, работающих на оборудовании. Это на Ubuntu 64. Это очень расстраивает меня, так как нет четкого пути.

Моя цель: Я хочу следоватьшаги в этом руководстве пользователя AS для инструментальных испытаний.

Я запустил скрипт

~ / myAOSP / development / tools / idegen / intellij-gen.sh myApp company / apps / MY_APP

и открыл MY_APP.iml в Android Studio.

Сейчас я пытаюсь собрать apk, используя gradle только для моего проекта, а также тестовый apk.

Основной myAOSP использует make-файлы.

Я следовал инструкциям здесь и также использовал build.gradle в качестве шаблонаhttps://developer.android.com/studio/intro/migrate#migrate-intellij

// This buildscript{} block configures the code driving the build
buildscript {
   /**
    * The nested repositories{} block declares that this build uses the
    * jcenter repository.
    */
    repositories {
        jcenter()
        google()
    }

   /**
    * This block declares a dependency on the 3.1.0 version
    * of the Gradle plugin for the buildscript.
    */
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.2'
    }
}

/**
 * This line applies the com.android.application plugin. Note that you should
 * only apply the com.android.application plugin. Applying the Java plugin as
 * well will result in a build error.
 */
apply plugin: 'com.android.application'

/**
 * This dependencies block includes any dependencies for the project itself. The
 * following line includes all the JAR files in the libs directory.
 */
dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    testImplementation 'junit:junit:4.12'
    // Add other library dependencies here (see the next step)
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
}

/**
 * The android{} block configures all of the parameters for the Android build.
 * You must provide a value for at least the compilation target.
 */
android {
    compileSdkVersion 23
    buildToolsVersion '27.0.3'
    defaultConfig {
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    /**
    * This nested sourceSets block points the source code directories to the
    * existing folders in the project, instead of using the default new
    * organization.
    */
    sourceSets {
        main {
            manifest.srcFile 'AndroidManifest.xml'
            java.srcDirs = ['src']
            resources.srcDirs = ['src']
            aidl.srcDirs = ['src']
            renderscript.srcDirs = ['src']
            res.srcDirs = ['res']
            assets.srcDirs = ['assets']
        }

        // Move the tests to tests/java, tests/res, etc...
        androidTest.setRoot('tests')

       /**
        * Move the build types to build-types/<type>
        * For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
        * This moves them out of them default location under src/<type>/... which would
        * conflict with src/ being used by the main source set.
        * Adding new build types or product flavors should be accompanied
        * by a similar customization.
        */
        debug.setRoot('build-types/debug')
        release.setRoot('build-types/release')
     }
}

repositories {
    jcenter()
    google()
}

Также была ошибка gradle: так как Android M строится с JDK 1.7, но Android Studio gradle использует 1.8, я выполнил шаги, но имел ошибку gradle, Не удалось установить неизвестное свойство 'sourceCompatibility' для корневого проекта 'MY_PROJECT' типа `org .gradle.api.Project. docs.gradle.org/current/userguide/building_java_projects.html # в $ HOME / .gradle / gradle.properties javaHome = / Библиотека / Java / JavaVirtualMachines / 1.7.0.jdk / Contents / Home

targetJavaVersion = 1.7 build.gradle sourceCompatibility = targetJavaVersion –`

Я видел посты вродеРазработка AOSP с Android Studio но они устарели или не актуальны. Такжеhttp://ronubo.blogspot.com/2016/01/debugging-aosp-platform-code-with.html?view=magazine а такжеОшибка: (23, 17) Не удалось разрешить: junit: junit: 4.12

Я ищу рабочее решение проблемы создания инструментированного тестового apk для приложения в настроенном AOSP и запуска инструментированных тестов на нем в Android Studio 3.1 (или более поздней версии).

а) если возможно построить инструментированный тестовый apk в gradle AS 3.1 (или более поздней версии), то, пожалуйста, предложите исправить показанную ошибку gradle.

б) если сборка Gradle в а) выше невозможна, то нужно ли мне собирать инструментальный тестовый apk с использованием текущих make-файлов в настроенном AOSP?

c) если я создаю инструментированный тестовый apk с использованием make-файлов, то могу ли я по-прежнему использовать инструментарий UI в AS для запуска тестов на оборудовании?

Ответы на вопрос(1)

Ваш ответ на вопрос