Original address: http://bbs.18183.com/thread-149758-1-1.html
My development environment: Mac system, ECLIPSE, UNITY4.0
Development process:
1. Prepare to Unity for interactive Android-owned Class.jar files.
My procedure is: Application->untity folder->unity-> right: Show Package Contents->contents folder->playbackengines folder Androidplayer folder->bin folder->class. JAR "Directory:/applications/unity/unity.app/contents/playbackengines/androidplayer/bin" is copied out for backup.
2. Create a new Android project, copy the Class.jar to the Project Libs folder, and copy the 91SDK Ndcomplatform.jar to the Libs folder, Mainactivity extends Unityplayeractivity, you will need to call the Android SDK method to write well. The Androidmanifest.xml is configured according to 91SDK requirements. You do not need to introduce 91SDK res files in your Android project. To fix the android4.0+ system crash problem, add "| ScreenSize ".
such as: <activity android:name= "com.nd.commplatform.activity.SNSLoginActivity"
android:configchanges= "orientation|keyboardhidden|navigation|screensize"android:theme= "@Android: Style/theme.notitlebar.fullscreen"android:windowsoftinputmode= "Adjustpan"android:windowbackground= "@null"android:launchmode= "Singletask"/><ignore_js_op><ignore_js_op> 3. Then, on the project, right-click Run as->android application. Go to the project directory->bin folder->classes folder, and copy all of the files into a directory that you have found, such as jaru3d this folder.
4 Open Terminal, enter uaru3d this folder, input: JAR-CVF Myclass.jar * Enter, jaru3d folder will be more out: Myclass.jar, the file to do backup. <ignore_js_op>
5. Open unity3d4.0 to create a new unity Project, create a new folder under the Assets folder plugins, create a new Android folder in the Plugins folder, create a new Bin folder and Libs folder in the Android folder, Copy the Myclass.jar to the Bin folder and copy the 91SDK Ndcomplatform.jar to the Libs folder, copy all of the 91SDK res folders to the Android folder, Copy the Android project's androidmanifest.xml to the Andorid folder and copy the resources from the Android project to the corresponding folder in the Unity Project Res folder. in the Assets folder, create a unity call to Android file, drag the file to main camera and release the mouse to bind.
<ignore_js_op>
6.UNITY Package for APK installation package for demo effect test. Note The bundle identifier in the Playersettings configuration will be the same as the Android project's package.
<ignore_js_op>
<ignore_js_op>
7. Success, see victory.
<ignore_js_op>
< ignore_js_op>
# #李工文中提及文件-----old version
Android Project: <ignore_js_op> u3dandroid.zip (3.77 MB, download Count: 1979)
unity3d4.0 Project: <ignore_js_op> u3dprj.zip (2.92 MB, download count: 1692)
untiydemo-apk Package: <ignore_js_op> u3ddemo.apk.zip (9.68 MB, download count: 4131)
# #SDK开发新做DEMO-----Newer version, not the latest
SDK3.2.6 new Demo: <ignore_js_op> unity3d_91sdk_demo.zip (17.63 MB, download count: 15824)
2013-8-2 18:04 Upload Click file name to download attachments
Note: The properties of snscontrolcenteractivity and snsloginactivity inside the manifest.xml should be android:configchanges= "orientation| Keyboardhidden|navigation|screensize ",
Otherwise may cause the screen crash, the specific reason inquires the Google adnroid official website. excerpt from the original:
note:if Your application targets API level/higher (as declared by the minsdkversion and targetsdkversion attrib Utes. Should also declare the "screensize" configuration, because it also changes when a device switches BETW Een portrait and landscape orientations.
"ScreenSize"
The current available screens size has changed. This represents a change in the currently available size, relative to the current aspect ratio, so would change
When the user switches between landscape and portrait. However, if your application targets API level-or lower, then your activity -always-handles this
Configuration Change itself (this configuration change does not restart your activity, even if running on an Android 3.2 or higher device).Added in API level.