Android Studio记录一个问题:常见编译错误

Could not determine the dependencies of task ‘:app:compileDebugJavaWithJavac’.

Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
> Installed Build Tools revision 31.0.0 is corrupted. Remove and install again using the SDK Manager.

* 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.

在这里插入图片描述
在这里插入图片描述
修改版本号即可
改成buildToolsVersion "30.0.0"后编译
报错

The specified Android SDK Build Tools version (30.0.0) is ignored, as it is below the minimum supported version (30.0.2) for Android Gradle Plugin 4.2.1.

The specified Android SDK Build Tools version (30.0.0) is ignored, as it is below the minimum supported version (30.0.2) for Android Gradle Plugin 4.2.1.
Android SDK Build Tools 30.0.2 will be used.
To suppress this warning, remove "buildToolsVersion '30.0.0'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.
Remove Build Tools version and sync project
Affected Modules: app

在这里插入图片描述
在这里插入图片描述
改成buildToolsVersion "30.0.2"编译后即可。

Execution failed for task ‘:app:processDebugMainManifest’.

Execution failed for task ':app:processDebugMainManifest'.
> Manifest merger failed : Apps targeting Android 12 and higher are required to specify an explicit value for `android:exported` when the corresponding component has an intent filter defined. See https://developer.android.com/guide/topics/manifest/activity-element#exported for details.

* 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.

在这里插入图片描述

在这里插入图片描述

点Run with --stacktrace ,可以看到详细报错,意思和现在报错也一样,就是清单中Activity中增加了一个android:exported="true"属性,允许被打开

在这里插入图片描述
重新编译

猜你喜欢

转载自blog.csdn.net/weixin_45208598/article/details/129089637