简体   繁体   English

将Android项目导入Android Studio后出现“不受支持的类型错误”

[英]'Unsupported type error' after importing Android project to Android Studio


( I am new to forum so please ignore any mistake while posting. I have already tried alot to tackle this error. ) 我是论坛新手,所以发布时请忽略任何错误。我已经尝试了很多方法来解决此错误。
I am new (Intern) to android. 我是Android的新手(实习生)。 My boss asked me make some changes in existing Eclipse project. 我的老板要求我在现有的Eclipse项目中进行一些更改。

For importing project to Android Studio, I commented out the following lines in project.properties file 为了将项目导入Android Studio,我在project.properties文件中注释了以下几行

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

Project successfully imported and I added dependencies. 项目成功导入,我添加了依赖项。

Upon building the project I got the following error 在构建项目时,出现以下错误

: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 错误的屏幕截图

Here is category_list.xml 这是category_list.xml

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

I don't know the types and files declared in values folder. 我不知道在values文件夹中声明的类型和文件。 Please have a look and elaborate. 请看看并详细说明。

Screenshot of values folder 值文件夹的屏幕截图

Details that may be of some relevance . 细节可能与之相关

I am using Android Studio 2.1.2 我正在使用Android Studio 2.1.2

AndroidManifest.xml 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) build.gradle (应用程序)

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' Android Studio-导入项目错误:任务':app:mergeDebugResources'执行失败

As the error states "category_list" is not a valid resource value type . 由于错误状态"category_list"不是有效的资源值type (even in Eclipse, so Gradle is doing you a favor here) (即使在Eclipse中,所以Gradle在这里帮了您一个忙)

Your options are booleans, integers, strings, dimensions, etc. 您可以选择布尔值,整数,字符串,维等。

You can see the full list of valid types for more detail. 您可以查看有效类型的完整列表以获取更多详细信息。

Perhaps, you meant this 也许,你的意思是

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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