Android 踩坑记

  1. Error:(5, 24) Color value not valid -- must be #rgb, #argb, #rrggbb, or #aarrggbb (at 'color' with value '#ff275FAE ').
    很明显的问题,color值写错了,多写了一个空格
  2. Could not find method google() for arguments [] on repository container of type org.gradle.api.internal.artifacts.dsl.DefaultRepositoryHandler.
    缺少gradle-wrapper.properties 或者该文件中没有指定distributionUrl
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
  1. Manifest merger failed : uses-sdk:minSdkVersion 1 cannot be smaller than version 7 declared in library [com.android.support:appcompat-v7:24.1.0]
    android:minSdkVersion 过低
  2. intermediates\res\merged\debug\values-v23\values-v23.xml Error:(4) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Inverse'. Error:(34) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Button.Colored'. Error:(4) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Inverse'.

这种是因为compileSdkVersion 与buildToolsVersion版本不一致
5. 如果想调用系统中hide的方法

def getLayoutLibPath() {
    return "${android.getSdkDirectory().getAbsolutePath()}" + "/platforms/" +
            android.compileSdkVersion +"/data/layoutlib.jar"
}
dependencies {
    provided files(getLayoutLibPath())
}
  1. Error:All flavors must now belong to a named flavor dimension. Learn more at https://d.android.com
    解决方法:defaultConfig 里面添加 flavorDimensions “versionCode” 就能解决不同的productFlavors 切换问题

  2. Android webView 不支持 window.location.ref

  3. Uncaught TypeError: Cannot call method ‘getItem’ of null at 因为 没有开启:
    settings.setDomStorageEnabled(true); 这个属性

  4. Manifest merger failed with multiple errors, see logs 这个错误 尤其令人恼火。 光说 看日志, 我TM的往哪看去,倒是说清楚呀
    解决方法 是执行 这个命令: gradlew processDebugManifest --stacktrace
    一般就能看到错误信息。 找到主要的 就能解决,比如说 我的

 Attribute application@allowBackup value=(false) from AndroidManifest.xml:80:9-36
        is also present at [org.litepal.android:core:1.5.1] AndroidManifest.xml:12:9-35 value=(true).
        Suggestion: add 'tools:replace="android:allowBackup"' to <application> element at AndroidManifest.xml:78:5-596:19 to override.

这个是因为一些属性和第三方发依赖的冲突了,按照提示’tools:replace=“android:allowBackup” 加上这个即可解决

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

悟红尘

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值