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 【\工程名\gradle\wrapper\gradle\wrapper查看】
工程根目錄,找到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:\Desktop\git\moduleToutiaoAd\build\intermediates\library_manifest\debug\AndroidManifest.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:\Users\Administrator\.gradle\gradle.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:\Desktop\git\moduleToutiaoAd\src\main\res\layout\listitem_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了。