Android studio 2.2.3构建错误

时间:2017-01-02 09:09:58

标签: java android android-studio

我将我的android studio更新为2.2.3,现在当我创建一个新项目时,我收到了这个错误:

enter image description here

我尝试了所有解决方案,例如:

  • 降级gradle
  • 将_JAVA_OPTIONS值编辑为“-Xms2048m”
  • dexOptions { javaMaxHeapSize“4g” }

我的build.gradle:

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="app.com.date.design.drawer.AddImagesFragment">

    <!-- TODO: Update blank fragment layout -->

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:id="@+id/layout1"
            android:baselineAligned="false"
            android:orientation="vertical">

            <ImageButton
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                app:srcCompat="@drawable/common_full_open_on_phone"
                android:id="@+id/image1" />

            <ImageButton
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                app:srcCompat="@drawable/common_full_open_on_phone"
                android:id="@+id/image2" />

            <ImageButton
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                app:srcCompat="@drawable/common_full_open_on_phone"
                android:id="@+id/image3" />

            <ImageButton
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                app:srcCompat="@drawable/common_full_open_on_phone"
                android:id="@+id/image4" />

            <ImageButton
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                app:srcCompat="@drawable/common_full_open_on_phone"
                android:id="@+id/image5" />

            <ImageButton
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                app:srcCompat="@drawable/common_full_open_on_phone"
                android:id="@+id/image6"
                android:layout_weight="0.05" />
        </LinearLayout>

    </RelativeLayout>

</FrameLayout>

我也更改了gradle.properties,但仍然收到此错误

1 个答案:

答案 0 :(得分:0)

这将解决它

apply plugin: 'com.android.application'

repositories {
    flatDir {
        dirs 'libs' // flatten library directory
    }
}

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.2"
    defaultConfig {
        applicationId "ir.pdnco.myapplication"
        minSdkVersion 15
        targetSdkVersion 25
        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:25.1.0'
    testCompile 'junit:junit:4.12'
}