Search Unity

Porting a game to Ouya. Need help please

Discussion in 'Android' started by yifu, Jan 9, 2013.

  1. yifu

    yifu

    Joined:
    Dec 23, 2012
    Posts:
    17
    Hey, guys,
    I am trying to port one of our game to Ouya,
    I am not sure if anyone experience my problems but here is the details:

    The demo of Ouya builds fine.
    But when I am trying to import the Ouya package to our game, and then make a build, it always says that
    "Error building Player: UnityException: Building DEX Failed!
    Failed to compile Java code to DEX. See the Console for details."

    Since it builds fine for the demo, but doesn't build for our game, I am guessing it is our manifest xml is not correctly configured.

    Our game has crazy amount of plugins for both android and ios version.
    So for android we already have a customized /merged AndroidManifest.xml that handles all the plugins activities(like IAP, w3i, chartboost, etc).
    I did add Ouya activity to our manifest xml though.
    Here is the manifest i am using to make the build , and you can see the Ouya activity I added there.
    Did I do something wrong here?
    What other things can cause "Error building Player: UnityException: Building DEX Failed!
    Failed to compile Java code to DEX. See the Console for details." ?
    In the Ouya Editor window, everything is white lit, so I believe, I already linked everything correctly.
    I am working on Mac btw.

    Thanks for you guys help.



    Code (csharp):
    1. <?xml version="1.0" encoding="utf-8"?>
    2. <manifest xmlns:android="http://schemas.android.com/apk/res/android"
    3.     package="tv.ouya.demo.OuyaUnityApplication"
    4.     android:installLocation="preferExternal"
    5.     android:versionCode="1"
    6.     android:versionName="1.0" >
    7.     <supports-screens
    8.         android:smallScreens="true"
    9.         android:normalScreens="true"
    10.         android:largeScreens="true"
    11.         android:xlargeScreens="true"
    12.         android:anyDensity="true"/>
    13.    
    14.     <!-- PERMISSONS -->
    15.     <uses-permission android:name="android.permission.INTERNET" />
    16.     <uses-permission android:name="android.permission.WAKE_LOCK" />
    17.    
    18.     <!-- Only this application can receive the messages and registration result -->
    19.     <uses-permission android:name="net.company.product.permission.C2D_MESSAGE" />
    20.     <permission
    21.         android:name="net.ourCompany.ProductName.permission.C2D_MESSAGE"
    22.         android:protectionLevel="signature" />
    23.    
    24.     <!-- This app has permission to register and receive data message -->
    25.     <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
    26.    
    27.     <!-- App must have this permissions to use the library -->
    28.     <uses-permission android:name="android.permission.GET_ACCOUNTS" />
    29.     <uses-permission android:name="android.permission.USE_CREDENTIALS" />
    30.     <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    31.     <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    32.     <uses-permission android:name="android.permission.READ_PHONE_STATE" />
    33.     <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    34.     <uses-permission android:name="android.permission.ACCESS_COURSE_LOCATION"/>
    35.     <uses-permission android:name="com.android.vending.BILLING" />
    36.    
    37.     <application
    38.         android:configChanges="orientation"
    39.         android:icon="@drawable/app_icon"
    40.         android:label="@string/app_name" >
    41.        
    42.        
    43.        
    44.         <activity android:name="net.OurCompany.unityplayer.UnityPlayerActivity"
    45.                   android:label="@string/app_name"
    46.                   android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen">
    47.             <intent-filter>
    48.                 <action android:name="android.intent.action.MAIN" />
    49.                 <category android:name="android.intent.category.LAUNCHER" />
    50.             </intent-filter>
    51.         </activity>
    52.        
    53.         <activity android:name="tv.ouya.demo.OuyaUnityApplication.OuyaUnityApplication" android:label="@string/app_name" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen">
    54.           <!--intent-filter>
    55.             <action android:name="android.intent.action.MAIN" />
    56.             <category android:name="android.intent.category.DEFAULT" />
    57.           </intent-filter-->
    58.         </activity>
    59.        
    60.         <!-- Prime 31 Etcetera activities -->
    61.         <activity android:name="com.prime31.EtceteraProxyActivity"></activity>
    62.         <activity android:name="com.prime31.WebViewActivity" android:configChanges="orientation"></activity>
    63.         <activity android:name="com.prime31.P31VideoPlayerActivity" android:configChanges="keyboard|keyboardHidden|orientation"></activity>
    64.        
    65.         <!-- Crittercism activity -->
    66.         <activity android:name="com.crittercism.NotificationActivity" />
    67.        
    68.         <!-- chartboost activities -->
    69.         <activity android:name="com.chartboost.sdk.CBDialogActivity"
    70.             android:configChanges="orientation|keyboard|keyboardHidden"
    71.             android:windowSoftInputMode="adjustResize"
    72.             android:theme="@android:style/Theme.Translucent"
    73.             android:launchMode="singleTop">
    74.         </activity>
    75.        
    76.         <!-- w3i activities -->
    77.         <activity android:name="com.w3i.offerwall.ui.RewardHistoryActivity" android:theme="@android:style/Theme.Translucent"/>
    78.         <activity android:name="com.w3i.offerwall.ui.ComplexVideoOfferActivity" android:theme="@android:style/Theme.NoTitleBar.Fullscreen" android:configChanges="orientation"></activity>
    79.         <activity android:name="com.w3i.offerwall.ui.OfferwallActivity" android:theme="@android:style/Theme.NoTitleBar.Fullscreen" android:configChanges="orientation"></activity>
    80.         <activity android:name="com.w3i.offerwall.ui.OfferDescriptionActivity" android:theme="@android:style/Theme.NoTitleBar.Fullscreen" android:configChanges="orientation"></activity>
    81.         <activity android:name="com.w3i.offerwall.ui.HistoryActivity" android:theme="@android:style/Theme.NoTitleBar.Fullscreen" android:configChanges="orientation"></activity>
    82.         <receiver android:name="com.w3i.advertiser.ReferralReceiver" >
    83.             <intent-filter>
    84.                 <action android:name="com.android.vending.INSTALL_REFERRER" />
    85.             </intent-filter>
    86.         </receiver>
    87.         <!-- FIND-REPLACE -->
    88.         <fr><find><![CDATA[ForwardNativeEventsToDalvik" android:value="false" />]]></find><replace><![CDATA[ForwardNativeEventsToDalvik" android:value="true" />]]></replace></fr>
    89.        
    90.         <!-- Use c2dm receiver in plugin -->
    91.         <service android:name=".C2DMReceiver" />
    92.  
    93.         <receiver
    94.             android:name="com.google.android.c2dm.C2DMBroadcastReceiver"
    95.             android:permission="com.google.android.c2dm.permission.SEND" >
    96.             <!-- Receive actual message -->
    97.             <intent-filter>
    98.                 <action android:name="com.google.android.c2dm.intent.RECEIVE" />
    99.                 <category android:name="net.compamny.product" /> <!-- This is the registered package name in google cd2m server -->
    100.             </intent-filter>
    101.             <!-- Receive the registration id -->
    102.             <intent-filter>
    103.                 <action android:name="com.google.android.c2dm.intent.REGISTRATION" />
    104.                 <category android:name="net.company.product" />
    105.             </intent-filter>
    106.         </receiver>
    107.  
    108.         <service android:name="com.google.android.c2dm.intent.REGISTER" />
    109.        
    110.         <service android:name="com.prime31.billing.BillingService" />
    111.         <receiver android:name="com.prime31.billing.BillingReceiver">
    112.             <intent-filter>
    113.                 <action android:name="com.android.vending.billing.IN_APP_NOTIFY" />
    114.                 <action android:name="com.android.vending.billing.RESPONSE_CODE" />
    115.                 <action android:name="com.android.vending.billing.PURCHASE_STATE_CHANGED" />
    116.             </intent-filter>
    117.         </receiver>
    118.  
    119.     </application>
    120.  
    121. </manifest>
    122.  
    123.  
     
  2. Dreamwriter

    Dreamwriter

    Joined:
    Jul 22, 2011
    Posts:
    472
    The problem is most likely your package name - which in the manifest you quoted is in the line package="tv.ouya.demo_OuyaUnityApplication". You need to make sure that matches up with what you have it set for in Unity (Player Settings->Other Settings->Bundle Identifier) and in OuyaUnityApplication.java in the Plugins/Android/src folder.