如何在较旧的Android设备上支持Material Design

如何在较旧的Android设备上支持Material Design,第1张

概述我正在尝试在我的项目中使用Material Design,但我没有找到导入它的方法.我花了很多时间在互联网和stackoverflow尝试用户的建议,但无论我尝试过什么都没有用. 我在Mac OSX 10.10上使用Android Studio 0.8.14.使用gradle 13.2和JDK jdk1.8.0_25.jdk.从图像中可以看出我的android SDK是完全最新的 这是我的傻瓜 a 我正在尝试在我的项目中使用Material Design,但我没有找到导入它的方法.我花了很多时间在互联网和stackoverflow尝试用户的建议,但无论我尝试过什么都没有用.

我在Mac OSX 10.10上使用Android Studio 0.8.14.使用gradle 13.2和JDK jdk1.8.0_25.jdk.从图像中可以看出我的androID SDK是完全最新的

这是我的傻瓜

androID {    signingConfigs {        TESTING {            keyAlias '****'            keyPassword '***'        }    }    compileSdkVersion 21    buildToolsversion "21.0.2"    defaultConfig {        applicationID "********"        minSdkVersion 14        targetSdkVersion 21        versionCode 1        versionname '1.0'    }    buildTypes {        deBUG {            applicationIDSuffix '.dev'        }        release {            runProguard false            proguardfiles getDefaultProguardfile('proguard-androID.txt'),'proguard-rules.pro'            signingConfig signingConfigs.TESTING        }    }    productFlavors {    }    compileOptions {        sourceCompatibility JavaVersion.VERSION_1_7        targetCompatibility JavaVersion.VERSION_1_7    }}dependencIEs {    compile 'com.androID.support:support-v4:21.+'    compile 'com.androID.support:support-v13:21.+'    compile 'com.androID.support:appcompat-v7:21.+'    compile 'com.androID.support:cardvIEw-v7:21.+'    compile 'com.androID.support:recyclervIEw-v7:21.+'    compile 'com.Google.androID.gms:play-services:6.1.+'    compile filetree(dir: 'libs',include: ['*.jar','*.aar'])}

值/ style.xml

<resources>    <!-- Base application theme. -->    <style name="Apptheme" parent="Apptheme.Base"/>    <style name="Apptheme.Base" parent="theme.AppCompat.light">    </style></resources>

值-21 / style.xml

<?xml version="1.0" enCoding="utf-8"?><resources>    <style name="Apptheme" parent="androID:theme.Material.light">        <!-- Customize your theme using Material Design here. -->    </style></resources>

当我在清理gradle之后自动在gradle中添加appcompat时,我的类中的所有R.都不起作用并显示错误消息“无法解析符号R”.不仅如此,我还收到以下错误和警告:

information:Gradle tasks [clean,:app:generateDeBUGSources,
:app:generateDeBUGTestSources] :app:clean :app:preBuild
:app:preDeBUGBuild :app:checkDeBUGManifest :app:preReleaseBuild
:app:prepareComAndroIDSupportAppcompatV72100library
:app:prepareComAndroIDSupportCardvIEwV72100library
:app:prepareComAndroIDSupportRecyclervIEwV72100library
:app:prepareComAndroIDSupportSupportV132100library
:app:prepareComAndroIDSupportSupportV42100library
:app:prepareComGoogleAndroIDGmsPlayServices6171library
:app:prepareDeBUGDependencIEs :app:compileDeBUGAIDl
:app:compileDeBUGRenderscript :app:generateDeBUGBuildConfig
:app:generateDeBUGAssets UP-TO-DATE :app:mergeDeBUGAssets
:app:generateDeBUGResValues UP-TO-DATE :app:generateDeBUGResources
:app:mergeDeBUGResources
/Users/User/AndroIDStudioProjects/TEST/app/build/intermediates/exploded-aar/com.androID.support/appcompat-v7/21.0.0/res/drawable-mdpi/abc_ab_share_pack_holo_dark.9.png:
libpng warning: iCCP: Not recognizing kNown sRGB profile that has been
edited
/Users/User/AndroIDStudioProjects/TEST/app/src/main/res/drawable-mdpi/ic_drawer.png:
libpng warning: iCCP: Not recognizing kNown sRGB profile that has been
edited
/Users/User/AndroIDStudioProjects/TEST/app/src/main/res/drawable-hdpi/ic_drawer.png:
libpng warning: iCCP: Not recognizing kNown sRGB profile that has been
edited
/Users/User/AndroIDStudioProjects/TEST/app/src/main/res/drawable-xhdpi/ic_drawer.png:
libpng warning: iCCP: Not recognizing kNown sRGB profile that has been
edited
/Users/User/AndroIDStudioProjects/TEST/app/build/intermediates/exploded-aar/com.androID.support/appcompat-v7/21.0.0/res/drawable-xhdpi/abc_ab_share_pack_holo_dark.9.png:
libpng warning: iCCP: Not recognizing kNown sRGB profile that has been
edited
/Users/User/AndroIDStudioProjects/TEST/app/build/intermediates/exploded-aar/com.androID.support/appcompat-v7/21.0.0/res/drawable-hdpi/abc_spinner_mtrl_am_@R_404_5997@.9.png:
libpng warning: iCCP: Not recognizing kNown sRGB profile that has been
edited
/Users/User/AndroIDStudioProjects/TEST/app/build/intermediates/exploded-aar/com.androID.support/appcompat-v7/21.0.0/res/drawable-hdpi/abc_ab_share_pack_holo_light.9.png:
libpng warning: iCCP: Not recognizing kNown sRGB profile that has been
edited
/Users/User/AndroIDStudioProjects/TEST/app/build/intermediates/exploded-aar/com.androID.support/appcompat-v7/21.0.0/res/drawable-hdpi/abc_ab_share_pack_holo_dark.9.png:
libpng warning: iCCP: Not recognizing kNown sRGB profile that has been
edited
/Users/User/AndroIDStudioProjects/TEST/app/build/intermediates/exploded-aar/com.androID.support/appcompat-v7/21.0.0/res/drawable-xhdpi/abc_ab_share_pack_holo_light.9.png:
libpng warning: iCCP: Not recognizing kNown sRGB profile that has been
edited :app:processDeBUGManifest
Warning:/Users/User/AndroIDStudioProjects/TEST/app/src/main/AndroIDManifest.xml:11:5
Warning: Element
uses-permission#androID.permission.ACCESS_COARSE_LOCATION at
AndroIDManifest.xml:11:5 duplicated with element declared at
AndroIDManifest.xml:9:5
Warning:/Users/User/AndroIDStudioProjects/TEST/app/src/main/AndroIDManifest.xml:12:5
Warning: Element
uses-permission#androID.permission.ACCESS_FINE_LOCATION at
AndroIDManifest.xml:12:5 duplicated with element declared at
AndroIDManifest.xml:10:5
/Users/User/AndroIDStudioProjects/TEST/app/src/main/AndroIDManifest.xml
Warning:(11,5) Element
uses-permission#androID.permission.ACCESS_COARSE_LOCATION at
AndroIDManifest.xml:11:5 duplicated with element declared at
AndroIDManifest.xml:9:5 Warning:(12,5) Element
uses-permission#androID.permission.ACCESS_FINE_LOCATION at
AndroIDManifest.xml:12:5 duplicated with element declared at
AndroIDManifest.xml:10:5 :app:processDeBUGResources
/Users/User/AndroIDStudioProjects/TEST/app/build/intermediates/exploded-aar/com.androID.support/appcompat-v7/21.0.0/res/values-v11/values.xml Error:(36,21) No resource found that matches the given name: attr
‘androID:actionModeShareDrawable’. Error:(36,21) No resource found
that matches the given name: attr ‘androID:actionModeShareDrawable’.
Error:(36,21) No resource found
that matches the given name: attr ‘androID:actionModeShareDrawable’.
/Users/User/AndroIDStudioProjects/TEST/app/build/intermediates/exploded-aar/com.androID.support/appcompat-v7/21.0.0/res/values-v14/values.xml Error:(9,21) No resource found that matches the given name: attr
‘androID:actionModeShareDrawable’. Error:(9,21) No resource found
that matches the given name: attr ‘androID:actionModeShareDrawable’.
Error:(9,21) No resource found
that matches the given name: attr ‘androID:actionModeShareDrawable’.
/Users/User/AndroIDStudioProjects/TEST/app/build/intermediates/exploded-aar/com.androID.support/appcompat-v7/21.0.0/res/values-v21/values.xml Error:(298,21) No resource found that matches the given name: attr
‘androID:overlapAnchor’. Error:(298,21) No resource found that
matches the given name: attr ‘androID:overlapAnchor’. Error:Execution
Failed for task ‘:app:processDeBUGResources’.

com.androID.IDe.common.internal.LoggedErrorException: Failed to run command: /Users/User/androID-sdk/build-tools/21.0.2/aapt package -f
–no-crunch -I /Users/User/androID-sdk/platforms/androID-21/androID.jar -M
/Users/User/AndroIDStudioProjects/TEST/app/build/intermediates/manifests/full/deBUG/AndroIDManifest.xml
-S /Users/User/AndroIDStudioProjects/TEST/app/build/intermediates/res/deBUG
-A /Users/User/AndroIDStudioProjects/TEST/app/build/intermediates/assets/deBUG
-m -J /Users/User/AndroIDStudioProjects/TEST/app/build/generated/source/r/deBUG
-F /Users/User/AndroIDStudioProjects/TEST/app/build/intermediates/res/resources-deBUG.ap_
–deBUG-mode –custom-package andreou.maria.com.TEST -0 apk –output-text-symbols /Users/User/AndroIDStudioProjects/TEST/app/build/intermediates/symbols/deBUG
Error Code: 1 Output:
/Users/User/AndroIDStudioProjects/TEST/app/build/intermediates/res/deBUG/values-v11/values.xml:33:
error: Error: No resource found that matches the given name: attr
‘androID:actionModeShareDrawable’.
/Users/User/AndroIDStudioProjects/TEST/app/build/intermediates/res/deBUG/values-v14/values.xml:10:
error: Error: No resource found that matches the given name: attr
‘androID:actionModeShareDrawable’.
/Users/User/AndroIDStudioProjects/TEST/app/build/intermediates/res/deBUG/values-v11/values.xml:39:
error: Error: No resource found that matches the given name: attr
‘androID:actionModeShareDrawable’.
/Users/User/AndroIDStudioProjects/TEST/app/build/intermediates/res/deBUG/values-v14/values.xml:17:
error: Error: No resource found that matches the given name: attr
‘androID:actionModeShareDrawable’.
/Users/User/AndroIDStudioProjects/TEST/app/build/intermediates/res/deBUG/values-v11/values.xml:45:
error: Error: No resource found that matches the given name: attr
‘androID:actionModeShareDrawable’.
/Users/User/AndroIDStudioProjects/TEST/app/build/intermediates/res/deBUG/values-v14/values.xml:24:
error: Error: No resource found that matches the given name: attr
‘androID:actionModeShareDrawable’.
/Users/User/AndroIDStudioProjects/TEST/app/build/intermediates/res/deBUG/values-v11/values.xml:51:
error: Error: No resource found that matches the given name: attr
‘androID:actionModeShareDrawable’.
/Users/User/AndroIDStudioProjects/TEST/app/build/intermediates/res/deBUG/values-v14/values.xml:31:
error: Error: No resource found that matches the given name: attr
‘androID:actionModeShareDrawable’.
/Users/User/AndroIDStudioProjects/TEST/app/build/intermediates/res/deBUG/values-v21/values.xml:287:
error: Error: No resource found that matches the given name: attr
‘androID:overlapAnchor’.
/Users/User/AndroIDStudioProjects/TEST/app/build/intermediates/res/deBUG/values-v21/values.xml:295:
error: Error: No resource found that matches the given name: attr
‘androID:overlapAnchor’. information:BUILD Failed information:Total
time: 5.93 secs information:11 errors information:4 warnings
information:See complete output in console

谁能帮我?难道我做错了什么?

谢谢

解决方法 以下是一些可行的提示.

将buildToolsversion更改为已安装的最新版AndroID SDK Build-tools.在你的情况下,21.1虽然21.1.2现在可用.

根据应用中使用的API,减少minSdkVersion.

检查您的清单中的重复许可声明.

最重要的是,将依赖项更改为“com.androID.support:appcompat-v7:21.0”形式. ‘而不是’com.androID.support:appcompat-v7:21. “

同步并重建项目.

我希望这有帮助.

总结

以上是内存溢出为你收集整理的如何在较旧的Android设备支持Material Design全部内容,希望文章能够帮你解决如何在较旧的Android设备上支持Material Design所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://www.54852.com/web/1127701.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-30
下一篇2022-05-30

发表评论

登录后才能评论

评论列表(0条)

    保存