【问题标题】:Unable to generate apk file in Android Studio due to ResourceCycle error由于 ResourceCycle 错误,无法在 Android Studio 中生成 apk 文件
【发布时间】:2016-09-10 03:01:08
【问题描述】:

我正在尝试在 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>

感谢任何帮助,因为我已尝试使用谷歌搜索错误但无济于事。

【问题讨论】:

    标签: java android android-studio apk


    【解决方案1】:

    我找到了解决问题的方法。问题存在于我的应用文件中,我更改了

    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'
    

    【讨论】:

      猜你喜欢
      • 2016-01-08
      • 1970-01-01
      • 2016-09-11
      • 1970-01-01
      • 2018-05-04
      • 1970-01-01
      • 2018-09-19
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多