android 编译错误

A problem occurred configuring root project
Could not resolve all artifacts for configuration ‘:classpath’.

Could not resolve com.baidu.mobstat:mtj-circle-plugin:latest.integration.

android 编译错误

看到这个错误是不是觉得网络不行,或者配置文件出问题了,百度只要加个代理就能下载。

我试过一些常用的修补方法,加代理,换版本好,清缓存,都不行。

没那么简单,因为android studio喜欢声东击西,不能光看上面的错误日志。

于是,在细看一下,会发现一个提示 could not get 403,然后你去搜索这个域名就会发现被禁了。

所以很简单,注释掉这个域名开头的引用,尝试编译,通过。

ExoPlayerImplInternal:Source error.

UnrecognizedInputFormatException:None of the available extractors(MatroskaExtractor,FragmentedMp4Extractor,Mp4Extractor,Mp3Extractor。。。)

视频Mp4播放失败,于是看到一个异常。

android 编译错误

找了很多,跟换了各种内核,无法解决。

于是我下载了一个demo,发现可以,但是版本差异比较大,没发对比,于是打算升级一下。

升级后,报新错,于是开始百度找资料。

Execution failed for task ‘App:processDebugManifest’.

Could not get unknown property ‘instantRunManifestOutputDirectory’ for task ‘App:processDebugManifest’ of type com.android.build.gradle.tasks.ProcessApplicationManifest.

android 编译错误

后来我找到一个哥们的笔记:微小站-笔记-百度统计编译报错 (jsc0.com),很显然异常来自于百度移动统计的冲突。

由于本项目可以弃用这个百度移动统计,我直接把百度统计干掉了,在次运行,又来了一个新的伙伴。

AAPT: error: resource android:attr/lStar not found.

android 编译错误

到这里我有点察觉这个升级不简单了,这种编译包冲突清单合并类问题最恶心,于是我重新清除缓存,然后把编译版本换成 4.0.1,wrapper文件换成6.1.1版本。

最后确认 是 appcompat 1.4.0版本引起的,因为它引入了高版本的kotlin androidx.core:core 库,所以导致编译版本等拉高,不兼容

重新运行,又出现一个新异常。

Compilation failed; see the compiler error output for details.

android 编译错误

下面白字提示了,还是不兼容,一下午都在改bug,一个接一个,感觉又被AndroidStudio带吭里了。

后来寻求同事的帮助,同事也跟我一起升级,一样的错误出现,连环bug。

一直到第二天,同事发现了这个关键点,就是 升级后的视频库,引入了appcompat 1.4.0,于是他直接把1.4.0剔除了。

//视频播放器完整版引入
    api ('com.github.CarGuo.GSYVideoPlayer:gsyVideoPlayer-java:v8.1.8-release-jitpack'){
        exclude group: 'androidx.appcompat'
    }
    //是否需要ExoPlayer模式
    api ('com.github.CarGuo.GSYVideoPlayer:GSYVideoPlayer-exo2:v8.1.8-release-jitpack'){
        exclude group: 'androidx.appcompat'
    }

然后在运行,ok了,但是我这边还是不行,发现我本地之前查找资料,把所有appcompat升级了,根本原因就是appcompat1.4.0引发的。

我把所有appcompat库回退1.2.0后,在次运行,通过了。

简直无语加吐槽,as的报错机制非常短小无力。

最近新拉项目,运行后报错,as果然又没让我失望过。

Execution failed for task ‘: service:kaptDebugKotlin‘.

A failure occurred while executing org.jetbrains.kotlin.gradle.internal.KaptWithoutKotlincTask$KaptExecutionWorkAction
java.lang.reflect. InvocationTargetException (no error message)

android 编译错误

花里胡哨一堆文章,没啥用,首先可以确认,项目是没问题的,因为线上都ok,同事也都在用,那么就肯定是环境问题。

改下jdk版本,改成11。

android 编译错误

发现后面一堆花里胡哨的错误,如果钻进去了,就完蛋了,很不幸,我钻过。

然后就是重新清除一下缓存,在 sync 一下代码,在次运行,解决。

NoBeanDefFoundException: No definition found for class

android 编译错误

这个很明显,没注入 viewmodel,使用了注入方式别忘记了注入

val settingModule = module {
    viewModel { TestViewModel(get()) }
}

Could not track an OkHttp3 request Stream close OkHttp3Interceptor

使用了 AS 的 App Inspection 调试后会出现这个错,Database Inspector 数据库分析器或 Profiler 网络监控器,一直上传文件失败,把调试关了就行。

Original: https://www.cnblogs.com/LiuZhen/p/15791564.html
Author: 翻滚的咸鱼
Title: android 编译错误

原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/580339/

转载文章受原作者版权保护。转载请注明原作者出处!

(0)

大家都在看

亲爱的 Coder【最近整理,可免费获取】👉 最新必读书单  | 👏 面试题下载  | 🌎 免费的AI知识星球