• Android Studio工具使用中遇到的问题、


    2021-01-30 Android Studio 4.1.2

    Caused by: org.gradle.internal.metaobject.AbstractDynamicObject$CustomMessageMissingMethodException: Could not find method google() for arguments [] on repository container.

    好像不是支持google()语法,

    把根目录中的build.gradle文件中的

    buildscript {
        repositories {
            jcenter()
            //google()
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:3.0.0'
        }
    }
    allprojects {
    repositories {
    jcenter()
    //google()
    }
    }
     

    google()注释掉。

    Could not find com.android.tools.build:gradle:3.0.0.
    Searched in the following locations:
      https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.0/gradle-3.0.0.pom
      https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.0/gradle-3.0.0.jar
    Required by:
    project :
    Add google Maven repository and sync project
    Open File

    这个是之前注解了google(),它又需要google的资源,加一个阿里的地址:maven{url "https://maven.aliyun.com/repository/google"}

    buildscript {
        repositories {
            maven{url "https://maven.aliyun.com/repository/google"}
            jcenter()
            //google()
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:3.0.0'
        }
    }

    上午 8:30 Gradle sync failed: Your project path contains non-ASCII characters. This will most likely cause the build to fail on Windows. Please move your project to a different directory. See http://b.android.com/95744 for details. This warning can be disabled by adding the line 'android.overridePathCheck=true' to gradle.properties file in the project directory.
    Consult IDE log for more details (Help | Show Log) (10 s 586 ms)

    这个是说我的工程在所在目录路径有中文字符,把我的工程移到非中文目录就好。

    上午 8:40 Gradle sync failed: Minimum supported Gradle version is 4.1. Current version is 3.3.
    Please fix the project's Gradle settings.

    gradle的版本太低,升级一下就好了。

    如果是因为网络不好,可以参考这个,手动下载:https://blog.csdn.net/iblade/article/details/78930101

    Unable to find method 'org.gradle.api.internal.TaskInputsInternal.property(Ljava/lang/String;Ljava/lang/Object;)Lorg/gradle/api/tasks/TaskInputs;'
    org.gradle.api.internal.TaskInputsInternal.property(Ljava/lang/String;Ljava/lang/Object;)Lorg/gradle/api/tasks/TaskInputs;

    Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)

    Re-download dependencies and sync project (requires network)
    The state of a Gradle build process (daemon) may be corrupt. Stopping all Gradle daemons may solve this problem.

    Stop Gradle build processes (requires restart)
    Your project may be using a third-party plugin which is not compatible with the other plugins in the project or the version of Gradle requested by the project.

    In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.

    这个主要是gradle版本和插件版本不匹配造成的。

    我的gradle版本用的是6.5 【工程名gradlewrappergradlewrapper查看】

    工程根目录,找到build.gradle,把 com.android.tools.build:gradle:3.0.0 改成 com.android.tools.build:gradle:3.1.0

    buildscript {
        repositories {
            maven{url "https://maven.aliyun.com/repository/google"}
            jcenter()
            //google()
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:3.1.0'
        }
    }

    Execution failed for task ':app:preDebugBuild'.
    > Could not resolve all files for configuration ':app:debugCompileClasspath'.
    > Could not find com.android.support:support-v4:26.0.0.
    Searched in the following locations:
    - file:/D:/sdk/extras/m2repository/com/android/support/support-v4/26.0.0/support-v4-26.0.0.pom
    - file:/D:/sdk/extras/google/m2repository/com/android/support/support-v4/26.0.0/support-v4-26.0.0.pom
    - file:/D:/sdk/extras/android/m2repository/com/android/support/support-v4/26.0.0/support-v4-26.0.0.pom
    - https://jcenter.bintray.com/com/android/support/support-v4/26.0.0/support-v4-26.0.0.pom
    - file:/F:/Desktop/try/APICloudModuleSDK/app/libs/support-v4-26.0.0.jar
    - file:/F:/Desktop/try/APICloudModuleSDK/app/libs/support-v4.jar
    Required by:
    project :app
    > Could not find com.android.support:multidex:1.0.2.
    Searched in the following locations:
    - file:/D:/sdk/extras/m2repository/com/android/support/multidex/1.0.2/multidex-1.0.2.pom
    - file:/D:/sdk/extras/google/m2repository/com/android/support/multidex/1.0.2/multidex-1.0.2.pom
    - file:/D:/sdk/extras/android/m2repository/com/android/support/multidex/1.0.2/multidex-1.0.2.pom
    - https://jcenter.bintray.com/com/android/support/multidex/1.0.2/multidex-1.0.2.pom
    - file:/F:/Desktop/try/APICloudModuleSDK/app/libs/multidex-1.0.2.jar
    - file:/F:/Desktop/try/APICloudModuleSDK/app/libs/multidex.jar
    Required by:
    project :app
    > Could not find com.android.support:multidex:1.0.2.
    Searched in the following locations:
    - file:/D:/sdk/extras/m2repository/com/android/support/multidex/1.0.2/multidex-1.0.2.pom
    - file:/D:/sdk/extras/google/m2repository/com/android/support/multidex/1.0.2/multidex-1.0.2.pom
    - file:/D:/sdk/extras/android/m2repository/com/android/support/multidex/1.0.2/multidex-1.0.2.pom
    - https://jcenter.bintray.com/com/android/support/multidex/1.0.2/multidex-1.0.2.pom
    - file:/F:/Desktop/try/APICloudModuleSDK/app/libs/multidex-1.0.2.jar
    - file:/F:/Desktop/try/APICloudModuleSDK/app/libs/multidex.jar
    Required by:
    project :app
    > Could not find com.android.support:support-v4:26.0.0.
    Searched in the following locations:
    - file:/D:/sdk/extras/m2repository/com/android/support/support-v4/26.0.0/support-v4-26.0.0.pom
    - file:/D:/sdk/extras/google/m2repository/com/android/support/support-v4/26.0.0/support-v4-26.0.0.pom
    - file:/D:/sdk/extras/android/m2repository/com/android/support/support-v4/26.0.0/support-v4-26.0.0.pom
    - https://jcenter.bintray.com/com/android/support/support-v4/26.0.0/support-v4-26.0.0.pom
    - file:/F:/Desktop/try/APICloudModuleSDK/app/libs/support-v4-26.0.0.jar
    - file:/F:/Desktop/try/APICloudModuleSDK/app/libs/support-v4.jar
    Required by:
    project :app > project :moduleScrollPicture

    Possible solution:
    - Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html

     解决办法:allprojects 也要加阿里云地址。

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

     2021-02-11

    More than one file was found with OS independent path 'AndroidManifest.xml'

    有其他cpu架构的so文件。

    https://blog.csdn.net/xu912996973/article/details/100116387

    2021-02-11

    Manifest merger failed : uses-sdk:minSdkVersion 1 cannot be smaller than version 16 declared in library [:moduleToutiaoAd] F:DesktopgitmoduleToutiaoAduildintermediateslibrary_manifestdebugAndroidManifest.xml as the library might be using APIs not available in 1
    Suggestion: use a compatible library with a minSdk of at most 1,
    or increase this project's minSdk version to at least 16,
    or use tools:overrideLibrary="cn.angelshelter.app.apicloud.toutiaoad" to force usage (may lead to runtime failures)

    在app下面的build.gradle文件中加上minSdkVersion

    android {

    defaultConfig {

    minSdkVersion 16
       }
    }

    出现让你关闭gradle的离线模式。

    这个应该是我电脑配置错了的原因,不具体普通性。

    之前设备代码的配置,不知道为什么,就被用到gradle上面了.

    C:UsersAdministrator.gradlegradle.properties

    把代理配置删除:

    systemProp.http.proxyHost=mirrors.neusoft.edu.cn
    systemProp.http.proxyPort=80

    2021-02-06

    android:requestLegacyExternalStorage="true"
    如果AndroidManifest.xml里的<application里有这句,
    那么根目录的build.gradle中 android -> compileSdkVersion必须大于等于29

    2021-02-21

    虽然我在这里设置了证书,但是点运行后,依然不是我指定的证书:

     解决办法:

    到app中的build.gradle文 件中修改

    android {
    
        signingConfigs {
            jhzp {
                storeFile         file('D:\xxx\xxx.keystore')
                storePassword 'xxxx'
                keyAlias 'illusion'
                keyPassword 'xxxxx'
            }
        }
        
    
        buildTypes {
            release {
                signingConfig signingConfigs.jhzp
            }
            debug {
    
                signingConfig signingConfigs.jhzp
            }
        }
    
    }

    参照:https://blog.csdn.net/qugengting/article/details/83025794

    2021-05-10

    模块打包,报错:

    compileOnly  files('libs/open_ad_sdk.aar')
    compileOnly files('libs/hellodaemon-1.2.2.aar')

    F:DesktopgitmoduleToutiaoAdsrcmain eslayoutlistitem_ad_icon_source_layout.xml:12: AAPT: error: resource drawable/tt_mute (aka cn.angelshelter.app.apicloud.toutiaoad:drawable/tt_mute) not found.

    换一种:

    provided  files('libs/open_ad_sdk.aar')
    provided files('libs/hellodaemon-1.2.2.aar')
    报错和上面一样。

    换成
    compile(name: 'open_ad_sdk', ext: 'aar')
    compile(name: 'hellodaemon-1.2.2', ext: 'aar')
    就ok了。

    2021-05-22

    在做安卓辅助开发AccessibilityService的时候,发现打的断点不生效,后来才发现,原来他们是不同进程,我就选中那个后台进程:

    点这个按钮就可以debug了。

  • 相关阅读:
    【BZOJ3518】点组计数 欧拉函数
    【BZOJ3677】[Apio2014]连珠线 换根DP
    【BZOJ3678】wangxz与OJ Splay
    【BZOJ3935】Rbtree 树形DP
    【BZOJ3958】[WF2011]Mummy Madness 二分+扫描线+线段树
    (转)Jquery中$.get(),$.post(),$.ajax(),$.getJSON()的用法总结
    string.Format出现异常"输入的字符串格式有误"的解决方法
    c# winForm使用Aspose.Cells读取CSV文件中文乱码问题
    PowerDesigner15.1给自定义架构表字段添加MS_Description出错
    MongoDB 多条件组合查询
  • 原文地址:https://www.cnblogs.com/angelshelter/p/14347912.html
Copyright © 2020-2023  润新知