gradle无法进行assembleRelease,出现编译错误
来源:3-3 生效patch
AgonyX
2021-06-16 12:46:04
问题描述:
我使用的是as的新版本进行编译的前部分都挺好, 然后到了gradle的编译的时候出现问题
这是terminal的错误输出:
D:\Project\AndroidStudioProjects\imoocProjCourse_hotFix>gradlew assembleRelease
> Configure project :app
TinkerSupport Plugin Version: 1.1.4
Requires:
Android Plugin for Gradle, Revision 2.0.0 or higher
Dependencies:
Gradle 2.10 or higher (Current Gradle Version: 6.5)
apply plugin: 'com.tencent.tinker.patch'
----------------------tinker build warning ------------------------------------
tinker auto operation:
excluding annotation processor and source template from app packaging. Enable dx jumboMode to reduce package size.
enable dx jumboMode to reduce package size.
disable preDexLibraries to prevent ClassDefNotFoundException when your app is booting.
disable archive dex mode so far for keeping dex apply.
tinker will change your build configs:
we will add TINKER_ID=null in your build output manifest file build/intermediates/manifests/full/*
if minifyEnabled is true
you will find the gen proguard rule file at build/intermediates/tinker_intermediates/tinker_proguard.pro
and we will help you to put it in the proguardFiles.
if multiDexEnabled is true
you will find the gen multiDexKeepProguard file at build/intermediates/tinker_intermediates/tinker_multidexkeep.pro
and we will help you to put it in the MultiDexKeepProguardFile.
if applyResourceMapping file is exist
we will build app apk with resource R.txt file
if resources.arsc has changed, you should use applyResource mode to build the new apk!
-----------------------------------------------------------------
WARNING: API 'variantOutput.getPackageApplication()' is obsolete and has been replaced with 'variant.getPackageApplicationProvider()'.
It will be removed at the end of 2019.
For more information, see https://d.android.com/r/tools/task-configuration-avoidance.
To determine what is calling variantOutput.getPackageApplication(), use -Pandroid.debug.obsoleteApi=true on the command line to display more information.
WARNING: API 'variant.getAssemble()' is obsolete and has been replaced with 'variant.getAssembleProvider()'.
It will be removed at the end of 2019.
For more information, see https://d.android.com/r/tools/task-configuration-avoidance.
To determine what is calling variant.getAssemble(), use -Pandroid.debug.obsoleteApi=true on the command line to display more information.
WARNING: API 'variantOutput.getProcessManifest()' is obsolete and has been replaced with 'variantOutput.getProcessManifestProvider()'.
It will be removed at the end of 2019.
For more information, see https://d.android.com/r/tools/task-configuration-avoidance.
To determine what is calling variantOutput.getProcessManifest(), use -Pandroid.debug.obsoleteApi=true on the command line to display more information.
WARNING: API 'variantOutput.getProcessResources()' is obsolete and has been replaced with 'variantOutput.getProcessResourcesProvider()'.
It will be removed at the end of 2019.
For more information, see https://d.android.com/r/tools/task-configuration-avoidance.
To determine what is calling variantOutput.getProcessResources(), use -Pandroid.debug.obsoleteApi=true on the command line to display more information.
----------------------tinker-support build warning ------------------------------------
if you not set autoBackupApkDir we will auto backup the build file to D:\Project\AndroidStudioProjects\imoocProjCourse_hotFix\app/tinker.
if overrideTinkerPatchConfiguration is true
we will override tinker patch configuration,you must use tinker-support's configuration
you will find the gen proguard rule file at build/intermediates/bugly_intermediates/bugly_proguard.pro
and we will help you to put it in the proguardFiles.
if enableProxyApplication is true
we will replace you real application to TINKER_PATCH_APPLICATION
if autoGenerateTinkerId is true
we will auto set base tinkerId as versionName.versionCode, like 1.0.1
-----------------------------------------------------------------
------ Tinker Support Override tinkerPatch Configuration ------
tinkerPatch {
tinkerEnable = true
oldApk = D:\Project\AndroidStudioProjects\imoocProjCourse_hotFix\app\build\bakApk/app-0616-12-18-47/app-release.apk
ignoreWarning = false
useSign = true
buildConfig {
applyMapping = D:\Project\AndroidStudioProjects\imoocProjCourse_hotFix\app\build\bakApk/app-0616-12-18-47/app-release-mapping.txt
applyResourceMapping = D:\Project\AndroidStudioProjects\imoocProjCourse_hotFix\app\build\bakApk/app-0616-12-18-47/app-release-R.txt
tinkerId = patch-0.0.1
keepDexApply = false
isProtectedApp = false
supportHotplugComponent = true
}
dex {
dexMode = jar
pattern = [classes*.dex, assets/secondary-dex-?.jar]
loader = [com.tencent.tinker.loader.*]
}
lib {
pattern = [lib/*/*.so]
}
res {
pattern = [res/*, r/*, assets/*, resources.arsc, AndroidManifest.xml]
ignoreChange = [assets/*_meta.txt]
largeModSize = 100
}
packageConfig {
}
sevenZip {
zipArtiface = com.tencent.mm:SevenZip:1.1.10
path =
}
------ End ------
variantName:Debug
outputVariantName:Debug
variantName:Release
outputVariantName:Release
> Task :app:processReleaseManifest
D:\Project\AndroidStudioProjects\imoocProjCourse_hotFix\app\src\main\AndroidManifest.xml:23:9-27:56 Warning:
activity#com.tencent.bugly.beta.ui.BetaActivity@android1:name was tagged at AndroidManifest.xml:23 to replace other declarations but no other declaration pre
sent
D:\Project\AndroidStudioProjects\imoocProjCourse_hotFix\app\src\main\AndroidManifest.xml:23:9-27:56 Warning:
activity#com.tencent.bugly.beta.ui.BetaActivity@android1:configChanges was tagged at AndroidManifest.xml:23 to replace other declarations but no other declar
ation present
D:\Project\AndroidStudioProjects\imoocProjCourse_hotFix\app\src\main\AndroidManifest.xml:23:9-27:56 Warning:
activity#com.tencent.bugly.beta.ui.BetaActivity@android1:theme was tagged at AndroidManifest.xml:23 to replace other declarations but no other declaration pr
esent
D:\Project\AndroidStudioProjects\imoocProjCourse_hotFix\app\src\main\AndroidManifest.xml:29:9-39:20 Warning:
provider#com.tencent.bugly.beta.utils.BuglyFileProvider@android1:name was tagged at AndroidManifest.xml:29 to replace other declarations but no other declara
tion present
D:\Project\AndroidStudioProjects\imoocProjCourse_hotFix\app\src\main\AndroidManifest.xml:29:9-39:20 Warning:
provider#com.tencent.bugly.beta.utils.BuglyFileProvider@android1:authorities was tagged at AndroidManifest.xml:29 to replace other declarations but no other
declaration present
D:\Project\AndroidStudioProjects\imoocProjCourse_hotFix\app\src\main\AndroidManifest.xml:29:9-39:20 Warning:
provider#com.tencent.bugly.beta.utils.BuglyFileProvider@android1:exported was tagged at AndroidManifest.xml:29 to replace other declarations but no other dec
laration present
D:\Project\AndroidStudioProjects\imoocProjCourse_hotFix\app\src\main\AndroidManifest.xml:29:9-39:20 Warning:
provider#com.tencent.bugly.beta.utils.BuglyFileProvider@android1:grantUriPermissions was tagged at AndroidManifest.xml:29 to replace other declarations but n
o other declaration present
D:\Project\AndroidStudioProjects\imoocProjCourse_hotFix\app\src\main\AndroidManifest.xml Warning:
meta-data#android.support.FILE_PROVIDER_PATHS@android1:name was tagged at AndroidManifest.xml:0 to replace other declarations but no other declaration presen
t
D:\Project\AndroidStudioProjects\imoocProjCourse_hotFix\app\src\main\AndroidManifest.xml Warning:
meta-data#android.support.FILE_PROVIDER_PATHS@android1:resource was tagged at AndroidManifest.xml:0 to replace other declarations but no other declaration pr
esent
> Task :app:tinkerProcessReleaseManifest
tinker add tinker_id_patch-0.0.1 to your AndroidManifest.xml D:\Project\AndroidStudioProjects\imoocProjCourse_hotFix\app\build\intermediates\merged_manifests\release
\AndroidManifest.xml
tinker add com.agony.imoocprojcourse_hotfix.MyApplication to dex loader pattern
tinker gen AndroidManifest.xml in build/intermediates/tinker_intermediates/AndroidManifest.xml
> Task :app:tinkerProcessReleaseResourceId
apply resource mapping file D:\Project\AndroidStudioProjects\imoocProjCourse_hotFix\app\build\bakApk/app-0616-12-18-47/app-release-R.txt is illegal, just ignore
> Task :app:tinkerSupportProcessReleaseManifest
manifestPath: D:\Project\AndroidStudioProjects\imoocProjCourse_hotFix\app\build\intermediates\merged_manifests\release\AndroidManifest.xml
app version:1.0.1
Remove TINKER_ID tinker_id_patch-0.0.1
tinkerpatch change application name from com.agony.imoocprojcourse_hotfix.MyApplication to com.tencent.bugly.beta.tinker.TinkerPatchReflectApplication
tinkerSupport add com.tencent.bugly.beta.tinker.TinkerPatchReflectApplication to dex loader pattern
tinkerSupport gen AndroidManifest.xml in build/intermediates/bugly_intermediates/AndroidManifest.xml
> Task :app:compileReleaseJavaWithJavac FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:compileReleaseJavaWithJavac'.
> java.lang.IllegalAccessError: class org.gradle.internal.compiler.java.ClassNameCollector (in unnamed module @0x46a6cc9c) cannot access class com.sun.tools.javac.co
de.Symbol$TypeSymbol (in module jdk.compiler) because module jdk.compiler does not export com.sun.tools.javac.code to unnamed module @0x46a6cc9c
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.5/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 4s
16 actionable tasks: 5 executed, 11 up-to-date
————————————————————————————————
然后我改用老师提供的demo进行测试,在进行再次assembleRelease的时候又因为java版本出现问题,求解
2回答
Kristen_0409
2021-11-05
同学,我发现你的问题和我的问题是一样的,请问一下你这个问题解决了吗?terminal中执行gradlewRelease为什么会fail
LovelyChubby
2021-06-16
1.尝试把android gradle plugin的版本号改成3.2.0
2.路径不要带中文
相似问题
回答 2
回答 1