资源样式/Theme.Base未找到。

10

当我尝试将Android代码构建到设备中时,在Android Studio中出现了以下错误:

错误:未找到资源样式/Theme.Base(又名com.example.android.bluetoothlegatt:style / Theme.Base)。 错误:链接参考失败。


你确定该资源存在吗? - A M
分享你的样式 XML。 - Ashish Kudale
@AM 没有资源可用。你能分享一下相关的代码片段吗? - tshivam
2个回答

5

在您的清单文件中使用AppTheme,请检查代码并查看我将要注释的行

     <application
        android:name=".application.MyApplication"
        android:allowBackup="true"
        android:icon="@drawable/app_icon"
        android:label="@string/app_name"
        android:roundIcon="@drawable/app_icon"
        android:supportsRtl="true"
        android:largeHeap="true"
        android:networkSecurityConfig="@xml/network_security_config"
        android:theme="@style/AppTheme">  // here

检查样式必须像这样:

<style name="AppTheme" parent="Theme.AppCompat.Light">
       ....customize Theme....
</style>

需要更新Appcompat库:

implementation 'com.android.support:appcompat-v7:28.0.0'

请查看这个链接,它与IT技术有关。


是的,我已将它更改为: android:theme="@style/AppTheme" 但仍然不起作用。 @Abhinav Gupta - tshivam
我按照你的建议进行了两个更改,但仍然出现以下错误:错误:找不到资源样式/Theme.Base(又名com.example.android.bluetoothlegatt:style/Theme.Base)。实际上,我的最终目标是构建类似BLE终端的应用程序,为此我已将bluetoothLEGATT示例代码导入Android Studio。 - tshivam
如何解决以下错误:错误: <jcenter.bintray.com> 的证书与任何主题备用名称都不匹配:[*.iitk.ac.in,iitk.ac.in] - tshivam
@tshivam 请查看此链接:https://dev59.com/clgR5IYBdhLWcg3wO7U0#45159167 - Abhinav Gupta
@tshivam 晚上9点后我们可以在TeamViewer上连接吗? - Abhinav Gupta
显示剩余2条评论

5

请修改以下任一项:

style name="AppBaseTheme" 

为了

style name="AppTheme" 

在你的styles.xml文件中。或者更改:

android:theme="@style/AppTheme"

为了

android:theme="@style/AppBaseTheme"

在您的清单应用标签中。

两者应该相同。基本上,您的应用程序正在尝试使用不存在的AppBaseTheme。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接