简体   繁体   中英

Unable to generate apk file in Android Studio due to ResourceCycle error

I am trying to generate the signed apk file for my app in android studio. I was able to do this successfully before but after changing one line of code, I get an error. The line of code I changed was in strings.xml.

from

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

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

to

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

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

All I did was change the admob test ad id to my real ad id. Now I get this error:

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.

Here is my styles.xml file:

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

I appreciate any help as I have tried googling the error but to no avail.

I found a solution to my problem. The issue resided within my app file and I changed

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

to

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM