Search Unity

Problem with Android Pro Export

Discussion in 'Android' started by NeedNap, May 7, 2013.

  1. NeedNap

    NeedNap

    Joined:
    Nov 1, 2012
    Posts:
    22
    I finish my mobile game for iOS and Android platforms.

    The game works fine on iOS, but now I have some problem while exporting the Android version.

    I need to generate the Eclipse project when Unity does the export because I need to add some settings to use external plugins (for example EasyCodeScanner needs to set camera permission).

    When I export from Unity (with the "Create Eclipse project layout" sets to true) my Android project is generated every time so I loose the changes I made to the project. The first question is: is there an option (like those in the iOS export) that maintain the project already created (without a complete overwrite)?

    Another problem I have is that if I export the Android version without the Eclipse project generation the game works fine on my device (except for the function used by the plugins that I can't configure as EasyCodeScanner). If I export the Android version with the Eclipse project generation it seams that Resources folder (loaded at run-time) are not generated so my app throws exceptions when loads these files!
    A few days ago it seemed to me that this thing had worked!
    This thing is driving me crazy.

    Do you have any advice for me?

    Thank you
     
  2. miksumortti

    miksumortti

    Joined:
    Apr 7, 2012
    Posts:
    204
    Can't you add the plugins in Unity, so you won't need the eclipse build thing?
     
  3. bitter

    bitter

    Unity Technologies

    Joined:
    Jan 11, 2012
    Posts:
    530
    Yeah, so the eclipse project generation has some flaws - to say the least. Some of which are purely eclipse related and some due to errors in the export functionality. We have re-worked the export option in 4.2, so hopefully it will make more sense - at least we have a more solid foundation to build upon.

    That said, why not go with what miksumortti suggested? If you don't like the idea of using a custom manifest in your project, you can probably trick unity into adding the camera permission to the manifest by adding a reference to the WebCamTexture in one of your scripts ;)
     
  4. NeedNap

    NeedNap

    Joined:
    Nov 1, 2012
    Posts:
    22
    Thank you bitter, thank you miksumortti,
    I'll try this solution.

    I don't know how to add plugins in Unity!
    I read the plugin documentation and follow the instructions.

    For example, the EaseCodeScanner plugin instructions say:
    "On Android only : If you import the plugin in an existing project, put the 2 plugin activities (RootActivity CameraActivity) in your own Manifest.xml file, otherwise make sure the bundle identifier in the player settings is the one declared in Assets/Plugins/Android/AndroidManifest.xml in the player settings (com.c4mprod.ezcodescanner).
    In your Manifest, RootActivity does not need to be MAIN if an other android plugin is already MAIN."

    From the Flurry plugin documentation:
    "To integrate Flurry Analytics into your Android application:
    1. Add the FlurryAgent.jar file to your classpath.
    ● If you're using Eclipse, modify your Java Build Path, and choose Add External JAR...
    ● If you're using the SDK tools directly, drop it into your libs folder and the ant task will pick it up.
    2. Configure AndroidManifest.xml: Required Permission:
    android.permission.INTERNET
    Required to send analytics data back to the flurry servers
    Optional Permission: android.permission.ACCESS_COARSE_LOCATIONor
    
    android.permission.ACCESS_FINE_LOCATION
    If your application has location permissions, analytics will track where your application is being used. Without this, only country level location information will be available. To disable detailed location reporting even when your app has permission, call FlurryAgent.setReportLocation(false)before calling
    FlurryAgent.onStartSession()
    and no detailed location information will be sent.
    Specify a versionName attribute in the manifest to have data reported under that version name.
    3. Add calls to onStartSession and onEndSession
    ● Insert a call to FlurryAgent.onStartSession(Context, String), passing it a reference
    to a Context object (such as an Activity or Service), and your project's API key. We recommend using the onStart method of each Activity in your application, and passing the Activity (or Service) itself as the Context object * passing the global Application context is not recommended.
    ● Insert a call to FlurryAgent.onEndSession(Context)when a session is complete. We recommend using the onStop method of each Activity in your application. Make sure to match up a call to onEndSession for each call of onStartSession, passing in the same Context object that was used to call onStartSession."

    Now for Flurry I'll try sheva solution (http://forum.unity3d.com/threads/87959-FlurryAgent-wrapper-for-Unity-3-2).

    I will let you know.