Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/209.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 错误:未找到与给定名称匹配的资源(位于';最小高度';值为';?attr/actionBarSize';)_Android_Android Studio_Android Gradle Plugin_Build.gradle - Fatal编程技术网

Android 错误:未找到与给定名称匹配的资源(位于';最小高度';值为';?attr/actionBarSize';)

Android 错误:未找到与给定名称匹配的资源(位于';最小高度';值为';?attr/actionBarSize';),android,android-studio,android-gradle-plugin,build.gradle,Android,Android Studio,Android Gradle Plugin,Build.gradle,我正在尝试构建android studio项目,但遇到以下错误: Error:(11, 28) No resource found that matches the given name (at 'minHeight' with value '?attr/actionBarSize'). Error:(12, 29) No resource found that matches the given name (at 'background' with value '?attr/colorPrim

我正在尝试构建android studio项目,但遇到以下错误:

Error:(11, 28) No resource found that matches the given name (at 'minHeight' with value '?attr/actionBarSize').
Error:(12, 29) No resource found that matches the given name (at 'background' with value '?attr/colorPrimary').
下面是我的XML文件

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:qwerjk="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/black" >

<android.support.v7.widget.Toolbar
    android:id="@+id/builder_toolbar"
    android:layout_height="wrap_content"
    android:layout_width="match_parent"
    android:minHeight="?attr/actionBarSize"
    android:background="?attr/colorPrimary" />

<RelativeLayout
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_above="@+id/layout_bottom"
    android:layout_below="@id/builder_toolbar"
    android:layout_centerInParent="true" >

    <RelativeLayout
        android:id="@+id/lCanvas"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true" >

        <ImageView
            android:id="@+id/imgEditor"
            android:layout_width="fill_parent"
            android:layout_height="100dp"
           android:layout_alignParentTop="true" />

        <qwerjk.better_text.MagicTextView
            android:id="@+id/tvEditTop"
            style="@style/BuilderText"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignTop="@id/imgEditor"
            android:layout_centerHorizontal="true"
            android:text="TOP"
            qwerjk:strokeColor="#FF000000"
            qwerjk:strokeJoinStyle="miter"
            qwerjk:strokeWidth="5" />

        <qwerjk.better_text.MagicTextView
            android:id="@+id/tvEditMid"
            style="@style/BuilderText"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerHorizontal="true"
            android:layout_centerVertical="true"
            android:text="MID"
            qwerjk:strokeColor="#FF000000"
            qwerjk:strokeJoinStyle="miter"
            qwerjk:strokeWidth="5" />

        <qwerjk.better_text.MagicTextView
            android:id="@+id/tvEditBot"
            style="@style/BuilderText"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignBottom="@id/imgEditor"
            android:layout_centerHorizontal="true"
            android:text="BOTTOM"
            qwerjk:strokeColor="#FF000000"
            qwerjk:strokeJoinStyle="miter"
            qwerjk:strokeWidth="5" />
    </RelativeLayout>

    <RelativeLayout
        android:layout_width="wrap_content"
        android:layout_height="fill_parent"
        android:layout_alignBottom="@id/lCanvas"
        android:layout_alignTop="@id/lCanvas" >

        <Button
            android:id="@+id/btnEditTop"
            android:layout_width="80dp"
            android:layout_height="wrap_content"
            android:layout_alignParentTop="true"
            android:background="@drawable/btn_blue"
            android:text="@string/top" />

        <Button
            android:id="@+id/btnEditMid"
            android:layout_width="80dp"
            android:layout_height="wrap_content"
            android:layout_centerVertical="true"
            android:background="@drawable/btn_blue"
            android:text="@string/center" />

        <Button
            android:id="@+id/btnEditBot"
            android:layout_width="80dp"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true"
            android:background="@drawable/btn_blue"
            android:text="@string/bottom" />
    </RelativeLayout>
</RelativeLayout>

<LinearLayout
    android:id="@+id/layout_bottom"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:background="@android:color/white"
    android:gravity="center"
    android:orientation="horizontal" >

    <FrameLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content">

        <FrameLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content">

            <Button
                android:id="@+id/btnSave"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:background="@drawable/btn_submit"
                android:gravity="center_vertical" />

        </FrameLayout>

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:text="@string/submit"
            android:id="@+id/submitText"
            android:textColor="@android:color/black"
            android:layout_gravity="center_horizontal|bottom"
            android:layout_marginBottom="10dp"
            android:textSize="20dp"
            android:textStyle="bold"
            android:layout_marginRight="7dp" />


    </FrameLayout>


    <Button
        android:id="@+id/btnCancel"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Cancel"
        android:visibility="gone" />
</LinearLayout>

<include layout="@layout/loading_overlay"/>
</RelativeLayout>
我的build.gradle文件:-

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


apply plugin: 'com.android.library'

android {
    compileSdkVersion Integer.parseInt(project.ANDROID_BUILD_SDK_VERSION)
    buildToolsVersion project.ANDROID_BUILD_TOOLS_VERSION

defaultConfig {
    minSdkVersion Integer.parseInt(project.ANDROID_BUILD_MIN_SDK_VERSION)
    targetSdkVersion Integer.parseInt(project.ANDROID_BUILD_TARGET_SDK_VERSION)
    versionCode 1
    versionName "1.0"
    proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}

lintOptions {
    abortOnError false
}

packagingOptions {
    exclude 'META-INF/DEPENDENCIES'
    exclude 'META-INF/NOTICE'
    exclude 'META-INF/LICENSE'
    exclude 'META-INF/LICENSE.txt'
    exclude 'META-INF/NOTICE.txt'
}
publishNonDefault true

productFlavors {
    cheezburger {

    }
    loquillo{
    }
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
provided 'com.android.support:appcompat-v7:23.1.0'
provided 'org.roboguice:roboguice:3.0.1'
provided 'org.roboguice:roboblender:3.0.1'
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.3'
provided 'com.google.android.gms:play-services:8.1.0'
compile 'com.google.code.gson:gson:2.3'
compile 'com.android.support:support-v4:23.1.0'
 }
此配置中有任何问题吗?
提前感谢。

如上所述,有两个属性导致了问题:-

android:minHeight="?attr/actionBarSize"
我用下面这句话代替了这句话,它起了作用

android:minHeight="?android:attr/actionBarSize"
对于第二个,即
android:background=“?attr/colorPrimary”
我尝试了
android:background=“?android:attr/colorPrimary”
,但它与android棒棒糖和更高版本兼容

因此,我必须用我的自定义颜色代码/可绘制颜色分配背景,比如
android:background=“#FF00FF”
,毫无疑问,这非常有效


如果任何主体有其他解决方案,请务必告诉我。

显示位于values文件夹中的attrs.xml文件。@ChiragSavsani我正在使用当前应用主题的属性。那就是什么?在android中:minHeight=“?attr/actionBarSize”表示。如果我错了,请纠正我。您是否尝试过为sdk版本传递具体值,而不是使用整数包装器?@PuruPawar是的,我尝试过,但问题仍然存在。
android:minHeight="?android:attr/actionBarSize"