簡體   English   中英

由於ResourceCycle錯誤,無法在Android Studio中生成apk文件

[英]Unable to generate apk file in Android Studio due to ResourceCycle error

我正在嘗試為我在android studio中的應用生成簽名的apk文件。 在此之前,我能夠成功完成此操作,但是在更改一行代碼后,出現錯誤。 我更改的代碼行在strings.xml中。

<resources>
    <string name="app_name">Flashlight</string>

    <string name="banner_ad_unit_id">ca-app-pub-3940256099942544/6300978111</string>
</resources>

<resources>
    <string name="app_name">Flashlight</string>

    <string name="banner_ad_unit_id">ca-app-pub-6203674096217868/4182598236</string>
</resources>

我所做的就是將admob測試廣告ID更改為我的真實廣告ID。 現在我得到這個錯誤:

Error:Error: Style Resource definition cycle: TextAppearance.AppCompat.Light.SearchResult.Title => TextAppearance.AppCompat.SearchResult.Title => TextAppearance.AppCompat.SearchResult.Title [ResourceCycle]
   Explanation for issues of type "ResourceCycle":
   There should be no cycles in resource definitions as this can lead to
   runtime exceptions.

這是我的styles.xml文件:

<resources>

    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
        <!-- Customize your theme here. -->
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
    </style>

    <style name="FullscreenTheme" parent="AppTheme">
        <item name="android:actionBarStyle">@style/FullscreenActionBarStyle</item>
        <item name="android:windowActionBarOverlay">true</item>
        <item name="android:windowBackground">@null</item>
        <item name="metaButtonBarStyle">?android:attr/buttonBarStyle</item>
        <item name="metaButtonBarButtonStyle">?android:attr/buttonBarButtonStyle</item>
    </style>

    <style name="FullscreenActionBarStyle" parent="Widget.AppCompat.ActionBar">
        <item name="android:background">@color/black_overlay</item>
    </style>

</resources>

感謝您嘗試搜索該錯誤但無濟於事的任何幫助。

我找到了解決問題的方法。 問題存在於我的應用程序文件中,因此我進行了更改

compile 'com.android.support:appcompat-v7:24.0.0-alpha1'
compile 'com.android.support:support-v4:24.0.0-alpha1'

compile 'com.android.support:support-v4:23.1.1'
compile 'com.android.support:appcompat-v7:23.1.1'

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM