从Android启动Unity时找不到main(错误)

从Android启动Unity时找不到main(错误),android,unity3d,Android,Unity3d,我正在尝试在单击按钮时启动UnityPlayerPractivity。但它抛出了一个错误“找不到主” 显然, <activity android:name="com.unity3d.player.UnityPlayerActivity" android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|orientation|screenLayout|ui

我正在尝试在单击按钮时启动UnityPlayerPractivity。但它抛出了一个错误“找不到主”

显然,

<activity
        android:name="com.unity3d.player.UnityPlayerActivity"
        android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|orientation|screenLayout|uiMode|screenSize|smallestScreenSize|fontScale|layoutDirection"
        android:label="@string/app_name"
        android:launchMode="singleTask"
        android:screenOrientation="landscape">
        <intent-filter>
            <category android:name="com.google.intent.category.CARDBOARD" />
        </intent-filter>
        <meta-data
            android:name="unityplayer.UnityActivity"
            android:value="true" />
    </activity>

只需构建armeabi-v7a构建即可。但是,如果您试图构建其他构建,如x86或universal apk,那么您将得到此类错误

因此,在gradle中,指定只构建armeabi-v7a apk

splits {

    // Configures multiple APKs based on ABI.
    abi {

        // Enables building multiple APKs per ABI.
        enable true

        // By default all ABIs are included, so use reset() and include to specify that we only
        // want APKs for x86, armeabi-v7a, and mips.

        // Resets the list of ABIs that Gradle should create APKs for to none.
        reset()

        // Specifies a list of ABIs that Gradle should create APKs for.
        include "armeabi-v7a"
    }
}
splits {

    // Configures multiple APKs based on ABI.
    abi {

        // Enables building multiple APKs per ABI.
        enable true

        // By default all ABIs are included, so use reset() and include to specify that we only
        // want APKs for x86, armeabi-v7a, and mips.

        // Resets the list of ABIs that Gradle should create APKs for to none.
        reset()

        // Specifies a list of ABIs that Gradle should create APKs for.
        include "armeabi-v7a"
    }
}