2016-01-20 24 views
0

所以我試圖創建一個自定義主題給我的preference_category文件,但後來決定刪除它。我從styles.xml中刪除了一個主題,從AndroidManifest.xml中刪除了一個字符串。當我建立這個項目時,它總是從死裏復活。每次我刪除它,它都在恢復。和字符串android:theme =「@ style/Theme.Custom」一樣從未被刪除!我得到的錯誤是我創建了一個自定義主題,刪除它,然後無法從AndroidManifest.xml中刪除它

Error:(51, 28) No resource found that matches the given name (at 'theme' with value '@style/Theme.Custom'). Error:Execution failed for task ':app:processDebugResources'. com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Users/lisa/Library/Android/sdk/build-tools/22.0.1/aapt'' finished with non-zero exit value 1 Information:BUILD FAILED

而不僅僅是這樣。我的manifest資源配置文件:

<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
package="com.example.tenderplan" 
android:versionCode="1" 
android:versionName="1.0" > 

<uses-sdk 
    android:minSdkVersion="14" 
    android:targetSdkVersion="23" /> 
<uses-permission android:name="android.permission.GET_ACCOUNTS" /> 
<uses-permission android:name="android.permission.READ_PROFILE" /> 
<uses-permission android:name="android.permission.READ_CONTACTS" /> 
<uses-permission android:name="android.permission.INTERNET" /> 
<uses-permission  android:name="android.permission.ACCESS_NETWORK_STATE" /> 
<uses-permission android:name="android.permission.CALL_PHONE" /> 

<supports-screens 
    android:anyDensity="true" 
    android:largeScreens="true" 
    android:normalScreens="true" 
    android:smallScreens="true" 
    android:xlargeScreens="true" /> 

<application 
    android:allowBackup="true" 
    android:icon="@drawable/notif" 
    android:label="Tenderplan" 
    android:supportsRtl="true" 
    android:theme="@style/AppTheme" > 
    <activity 
     android:name="com.example.tenderplan.activities.MainActivity" 
     android:label="Tenderplan" 
     android:theme="@style/AppTheme.NoActionBar" > 
     <intent-filter> 
      <action android:name="android.intent.action.MAIN" /> 

      <category android:name="android.intent.category.LAUNCHER" /> 
     </intent-filter> 
    </activity> 
    <activity 
     android:name="com.example.tenderplan.activities.LoginActivity" 
     android:theme="@style/AppTheme" /> 
    <activity 
     android:name="com.example.tenderplan.activities.ElementActivity" 
     android:theme="@style/AppTheme" /> 
    <activity 
     android:name="com.example.tenderplan.activities.SettingsActivity" 
     android:label="@string/title_activity_settings" 
     android:theme="@style/Theme.Custom" /> 
    <activity android:name="com.example.tenderplan.activities.EditActivity" /> 
    <activity android:name="com.example.tenderplan.activities.AddKeyActivity" /> 
    <activity android:name="com.example.tenderplan.activities.AnalyticsActivity" /> 
    <activity android:name="com.example.tenderplan.activities.AnalyticsCPActivity" /> 
</application> 

清單中這些字符串是紅色:

  1. http://schemas.android.com/apk/res/android"
  2. android:versionCode="1" android:versionName="1.0" >
  3. 支持屏
  4. android:allowBackup="true" android:icon="@drawable/notif"
  5. android:theme="@style/AppTheme" 和許多其他主題。

這是我的styles.xml:

<resources> 

<!-- Base application theme. --> 
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> 
    <!-- 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="AppTheme.NoActionBar"> 
    <item name="windowActionBar">false</item> 
    <item name="windowNoTitle">true</item> 
</style> 

<style name="AppTheme.AppBarOverlay" 
    parent="ThemeOverlay.AppCompat.Dark.ActionBar" /> 

<style name="AppTheme.PopupOverlay" 
    parent="ThemeOverlay.AppCompat.Light" /> 

而且,我import com.example.tenderplan.R;不能在活動中找到。

你能幫我找到正確答案嗎?

+0

你有沒有嘗試清理項目和運行? – Raghavendra

+0

檢查在建立文件夾或src文件夾中確切顯示錯誤「清單」的位置? – Raghavendra

+0

是的,我清理並重新啓動了幾次,但同樣的錯誤。 在生成文件夾中。 –

回答

0

您的SettingsActivity仍然具有主題Theme.Custom集,該集不再存在於styles.xml中。從AndroidManifest.xml中刪除行android:theme="@style/Theme.Custom"

+0

我曾說過,我從styles.xml和AndroidManifest.xml字符串中刪除了一個主題。當我建立這個項目時,它總是從死裏復活。每次我刪除它,它都在恢復。不知怎的,它認爲我不刪除這條線,並添加它本身。 –

0

我想我發現了類似的事情後我找到了答案。你需要從3個地方刪除自定義主題:

  1. 的Android清單文件
  2. 值\ Styles.xml文件
  3. Your_Project \程序\編譯\中間體\水庫\合併\調試\值\值。 xml

從所有這些地方刪除所有出現的自定義主題後,重建gradle。

這對我來說,檢查出來

相關問題