2016-07-30 71 views
0


我是新來的論壇,所以請忽略任何錯誤,而張貼。我已經嘗試了很多解決這個錯誤。
我是新(實習生)到android。我的老闆讓我在現有的Eclipse項目中做一些改動。
「不支持的類型錯誤」導入Android項目到Android工作室後

對於導入項目到Android Studio中,我註釋掉在project.properties以下行文件

#android.library.reference.1=..\\google-play-services_lib 
#android.library.reference.2=../androidv7-appcompatz 

項目成功導入和我說的依賴性。

在建設項目中,我得到了以下錯誤

:app:generateDebugResValues UP-TO-DATE 
:app:generateDebugResources 
:app:mergeDebugResources 
E:\Workspace\Intern\Quran\AlAjmi\app\src\main\res\values\category_lists.xml 
Error:Error: Unsupported type 'category_list' 
:app:mergeDebugResources FAILED 
Error:Execution failed for task ':app:mergeDebugResources'. 
> E:\Workspace\Intern\Quran\AlAjmi\app\src\main\res\values\category_lists.xml: Error: Unsupported type 'category_list' 
Information:BUILD FAILED 

Screenshot of error

這裏是category_list.xml

<?xml version="1.0" encoding="utf-8"?> 
<resources> 
    <item type="category_list" name="row">false</item> 
</resources> 

我不知道值的文件夾中聲明的類型和文件。請看看並詳細說明。

Screenshot of values folder

細節,可能會出現一些相關的。

我使用的是Android 2.1.2工作室

AndroidManifest.xml中

<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
    package="com.saturnteam.best.islamic.app.quran" 
    android:versionCode="1" 
    android:versionName="1.0" > 

    <uses-sdk 
     android:minSdkVersion="9" 
     android:targetSdkVersion="21" /> 

    <!-- for APPNEXT adds --> 
    <uses-permission android:name="android.permission.GET_ACCOUNTS" /> 
    <uses-permission android:name="android.permission.WAKE_LOCK" /> 
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> 
    <uses-permission android:name="android.permission.INTERNET" /> 
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> 
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> 
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> 

    <application 
     android:allowBackup="true" 
     android:icon="@drawable/ic_launcher" 
     android:label="@string/app_name" 
     android:theme="@style/Theme.AppCompat" > 
     <activity 
      android:name="com.saturnteam.best.islamic.app.quran.HomeActivity" 
      android:label="@string/app_name" > 
      <intent-filter> 
       <action android:name="android.intent.action.MAIN" /> 

       <category android:name="android.intent.category.LAUNCHER" /> 
      </intent-filter> 
     </activity> 
     <activity 
      android:name="com.saturnteam.best.islamic.app.quran.AudioListActivity" 
      android:launchMode="singleInstance" > 
     </activity> 
     <activity 
      android:name="com.saturnteam.best.islamic.app.quran.InfoActivity" 
      android:launchMode="singleInstance" > 
     </activity> 
     <activity 
      android:name="com.saturnteam.best.islamic.app.quran.PlayAudioFile" 
      android:launchMode="singleInstance" > 
     </activity> 

     <service android:name="com.saturnteam.best.islamic.app.quran.MediaPlayerService" /> 

     <!-- for APPNEXT adds --> 
     <service android:name="com.appnext.appnextsdk.DownloadService" /> 

     <!-- for HEYZAP --> 
     <activity 
      android:name="com.heyzap.sdk.ads.HeyzapInterstitialActivity" 
      android:configChanges="keyboardHidden|orientation|screenSize|smallestScreenSize" /> 

     <receiver android:name="com.heyzap.sdk.ads.PackageAddedReceiver" > 
      <intent-filter> 
       <data android:scheme="package" /> 

       <action android:name="android.intent.action.PACKAGE_ADDED" /> 
      </intent-filter> 
     </receiver> 

     <!-- for ADDMOBE adds add this below Activity --> 
     <activity 
      android:name="com.google.android.gms.ads.AdActivity" 
      android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" 
      android:screenOrientation="portrait" /> 

     <meta-data 
      android:name="com.google.android.gms.version" 
      android:value="@integer/google_play_services_version" /> 
    </application> 

</manifest> 

的build.gradle(APP)

apply plugin: 'com.android.application' 

android { 
    compileSdkVersion 23 
    buildToolsVersion "24.0.1" 

    defaultConfig { 
     applicationId "com.saturnteam.best.islamic.app.quran" 
     minSdkVersion 9 
     targetSdkVersion 21 
    } 

    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' 
     } 
    } 
} 

dependencies { 
    compile 'com.android.support:appcompat-v7:23.0.0' 
    compile 'com.google.android.gms:play-services:9.2.1' 
    compile files('libs/AppnextSDK.jar') 
    compile files('libs/heyzap-ads-sdk-7.2.4.jar') 
} 

Android Studio - Error importing project Error:Execution failed for task ':app:mergeDebugResources'

回答

1

由於錯誤狀態"category_list"不是有效的資源值type。 (即使是在Eclipse中,所以搖籃在這裏幫你的忙)

您的選項是布爾值,整數,字符串,尺寸等

你可以看到valid types的完整列表的詳細信息。

也許,你的意思是這個

<?xml version="1.0" encoding="utf-8"?> 
<resources> 
    <bool name="category_list_row">false</bool> 
</resources> 
+0

我真的很感激!我不知道爲什麼有值文件夾中有.xml文件有不同類型的名稱。 –

相關問題