首页 > 解决方案 > 如何在 Android Studio 中从实现切换到编译

问题描述

我还需要更新几个工具,但它说一切都是最新的...尝试编译 Mycroft AI Core,然后是 Mycroft AI Client APKs...这是 git repo:Mycroft-Android-Core图片 1 图片2

这是我的 gradle 文件...我找到的所有内容。我不确定还能做什么。

::Build.gradle 文件::

    // Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    ext.kotlin_version = "1.2.51"
    repositories {
        google()
        jcenter()
        maven { url 'https://maven.fabric.io/public' }
        maven { url 'https://maven.google.com' }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.1'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath "org.jetbrains.kotlin:kotlin-android-extensions:$kotlin_version"
        classpath 'io.fabric.tools:gradle:1.+'

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

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

    ext.versionMajor = 1
    ext.versionMinor = 0
    ext.versionPatch = 1
    ext.versionClassifier = "SNAPSHOT"

    project.ext {
        versionCode = ext.versionMajor * 10000 + ext.versionMinor * 100 + ext.versionPatch
        versionName = getVersionName()
    }
}

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

String getVersionName() {
    String versionName = "${ext.versionMajor}.${ext.versionMinor}.${ext.versionPatch}"
    if (ext.versionClassifier != null && !ext.versionClassifier.isEmpty()) {
        versionName = versionName + "-" + ext.versionClassifier
    }
    return versionName;
}

subprojects {
    project.configurations.all {
        resolutionStrategy.eachDependency { details ->
            if (details.requested.group == 'com.android.support'
                    && !details.requested.name.contains('multidex') ) {
                details.useVersion "$rootProject.supportVersion"
            }
        }
    }
}

ext {
    minSdkVersion = 19
    targetSdkVersion = 27
    compileSdkVersion = 27
    buildToolsVersion = "27.0.3"
    kotlinVersion = "1.2.51"
    supportVersion = "27.0.1"


::Build.Gradle (for **Mobile**)


    // Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    ext.kotlin_version = "1.2.51"
    repositories {
        google()
        jcenter()
        maven { url 'https://maven.fabric.io/public' }
        maven { url 'https://maven.google.com' }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.1'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath "org.jetbrains.kotlin:kotlin-android-extensions:$kotlin_version"
        classpath 'io.fabric.tools:gradle:1.+'

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

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

    ext.versionMajor = 1
    ext.versionMinor = 0
    ext.versionPatch = 1
    ext.versionClassifier = "SNAPSHOT"

    project.ext {
        versionCode = ext.versionMajor * 10000 + ext.versionMinor * 100 + ext.versionPatch
        versionName = getVersionName()
    }
}

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

String getVersionName() {
    String versionName = "${ext.versionMajor}.${ext.versionMinor}.${ext.versionPatch}"
    if (ext.versionClassifier != null && !ext.versionClassifier.isEmpty()) {
        versionName = versionName + "-" + ext.versionClassifier
    }
    return versionName;
}

subprojects {
    project.configurations.all {
        resolutionStrategy.eachDependency { details ->
            if (details.requested.group == 'com.android.support'
                    && !details.requested.name.contains('multidex') ) {
                details.useVersion "$rootProject.supportVersion"
            }
        }
    }
}

ext {
    minSdkVersion = 19
    targetSdkVersion = 27
compileSdkVersion = 27
buildToolsVersion = "27.0.3"
kotlinVersion = "1.2.51"
supportVersion = "27.0.1"

::Build.gradle移动版

    /*

         *  Copyright (c) 2017. Mycroft AI, Inc.
         *
         *  This file is part of Mycroft-Android a client for Mycroft Core.
         *
         *  This program is free software: you can redistribute it and/or modify
         *  it under the terms of the GNU General Public License as published by
         *  the Free Software Foundation, either version 3 of the License, or
         *  (at your option) any later version.
         *
         *  This program is distributed in the hope that it will be useful,
         *  but WITHOUT ANY WARRANTY; without even the implied warranty of
         *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
         *  GNU General Public License for more details.
         *
         *  You should have received a copy of the GNU General Public License
         *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
         *
         */
        apply plugin: 'com.android.application'
        apply plugin: 'io.fabric'
        apply plugin: 'kotlin-android'
        apply plugin: 'kotlin-android-extensions'

        android {

            compileSdkVersion rootProject.compileSdkVersion
            buildToolsVersion rootProject.buildToolsVersion
            defaultConfig {
                applicationId "mycroft.ai"
                minSdkVersion rootProject.minSdkVersion
                targetSdkVersion rootProject.targetSdkVersion
                versionCode project.ext.versionCode
                versionName project.ext.versionName
                testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
            }
            buildTypes {
                release {
                    minifyEnabled false
                    proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
                }
            }

            dataBinding {
                enabled=true
            }
        }

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

        dependencies {
            implementation fileTree(include: ['*.jar'], dir: 'libs')
            implementation "com.android.support:appcompat-v7:$rootProject.supportVersion"
            implementation "com.android.support:design:$rootProject.supportVersion"

            implementation "com.android.support:support-v4:$rootProject.supportVersion"

            // layout deps
            implementation "com.android.support:cardview-v7:$rootProject.supportVersion"
            implementation "com.android.support:recyclerview-v7:$rootProject.supportVersion"

            implementation "com.android.support:palette-v7:$rootProject.supportVersion"

            // Unit test dependencies
            testImplementation 'org.mockito:mockito-core:1.10.19'
            testImplementation 'org.powermock:powermock-api-mockito:1.6.4'
            testImplementation 'org.powermock:powermock-module-junit4-rule-agent:1.6.4'
            testImplementation 'org.powermock:powermock-module-junit4-rule:1.6.4'
            testImplementation 'org.powermock:powermock-module-junit4:1.6.4'
            testImplementation 'junit:junit:4.12'
            // Instrumentation dependencies
            androidTestImplementation 'com.android.support.test.espresso:espresso-core:2.2.2'
            androidTestImplementation 'com.android.support.test:runner:0.5'
            androidTestImplementation "com.android.support:support-annotations:$rootProject.supportVersion"
            implementation('com.crashlytics.sdk.android:crashlytics:2.5.7@aar') {
                transitive = true
            }
            implementation 'com.google.android.gms:play-services-wearable:9.4.0'
            wearApp project(':wear')
            implementation project(':shared')
            //kotlin
            implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
            //rxjava,rxandroid
            implementation 'io.reactivex.rxjava2:rxjava:2.2.3'
            implementation 'io.reactivex.rxjava2:rxandroid:2.1.0'

            implementation 'org.java-websocket:Java-WebSocket:1.3.0'

            implementation "com.android.support:support-core-utils:$rootProject.supportVersion"
        }
::Build.gradle **Watch**::

/* * 版权所有 (c) 2017。Mycroft AI, Inc. * * 此文件是 Mycroft-Android 的一部分,是 Mycroft Core 的客户端。* * 本程序是免费软件:您可以根据 * 自由软件基金会发布的 GNU 通用公共许可证条款重新分发和/或修改它,许可证的第 3 版,或 *(由您选择)任何更高版本。* * 分发此程序是希望它有用,* 但没有任何保证;甚至没有对特定用途的适销性或适用性的默示保证。有关详细信息,请参阅 * GNU 通用公共许可证。* * 您应该已经收到了一份 GNU 通用公共许可证 * 连同这个程序。如果没有,请参阅http://www.gnu.org/licenses/。* */

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'

android {

    compileSdkVersion rootProject.compileSdkVersion
    buildToolsVersion rootProject.buildToolsVersion
    defaultConfig {
        applicationId 'mycroft.ai'
        minSdkVersion rootProject.minSdkVersion
        targetSdkVersion rootProject.targetSdkVersion
        versionCode project.ext.versionCode
        versionName project.ext.versionName
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    productFlavors {
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    compileOnly 'com.google.android.wearable:wearable:2.4.0'
    implementation 'com.google.android.support:wearable:2.4.0'
    implementation 'com.google.android.gms:play-services-wearable:16.0.1'
    implementation project(':shared')
    implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
}

标签: android-studiocompilationapk

解决方案


推荐阅读