在Android Studio中创建项目时出现问题

时间:2017-08-08 23:52:20

标签: android

我在android studio中创建了一个新项目,当这个最终在主要活动中创建时标记了一些错误,其中一个错误是AppCpmátActivity,我知道这是因为我没有编译输出,但是我将它导出到我的Build.Gradle(模块应用程序)中。但是当我想要同步gradle时,这会显示下一个错误

those errors

这是我的build.gradle(模块:应用程序)

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    buildToolsVersion "26.0.1"
    defaultConfig {
        applicationId "demontechsystemsecurity.trackingtool"
        minSdkVersion 15
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:26.+'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    testCompile 'junit:junit:4.12'
}

我不知道究竟是什么问题,因为我选择下载所有的sdk工具和

这是build.gradle(项目:项目名称)

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

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.3'

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

allprojects {
    repositories {
        jcenter()
    }
}

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

如果我添加了存储库google(),则会显示此

this error

但如果我点击Upgrade plugin to version 2.3.3 and sync project这不会做任何操作

,则相同

1 个答案:

答案 0 :(得分:0)

添加maven {url“https://maven.google.com”}

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