问题1:报错
Execution failed for task ':app:mergeDebugResources'.
> Error: java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: AAPT2 error: check logs 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.
在gradie.properties中添加如下语句即可解决
android.enableAapt2=false
遇到sync报错
The option 'android.enableAapt2' is deprecated and should not be used anymore.
Use 'android.enableAapt2=true' to remove this warning.
It will be removed at the end of 2018..
不影响程序运行,暂时不理会。
问题2:
activity_main中design视图不加载。
解决方法:在res下的values文件夹中的styles.xml文件中,在下列标签中加入Base.路径
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
即<style name="AppTheme" parent="Base.Theme.AppCompat.Light.DarkActionBar">
即可解决。
2018/7/22
1、R文件资源丢失,项目build报错。解决方式。修改android.enableAapt2 = true
再build一遍项目,bug解决。
2、去除标题栏,综合博客和各类网站的此类问题,个人解决方法:删除AndroidManifest.xml文件中的android:label标签,
将android:theme标签修改为:
android:theme="@style/Theme.AppCompat.NoActionBar">标题栏成功去除。