2601人加入学习
(11人评价)
Unity3d與Android整合基礎
价格 ¥ 9.90
会员免费学 购买课程

各种报错,打击人信心啊

CommandInvokationFailure: Failed to re-package resources.
G:\ZuiZui\sdk\build-tools\24.0.2\aapt.exe package --auto-add-overlay -v -f -m -J "gen" -M "AndroidManifest.xml" -S "res" -I "G:/ZuiZui/sdk\platforms\android-24\android.jar" -F bin/resources.ap_ --extra-packages com.example.testunity2.resources -S "G:\ZuiZui\Unity3dWorkspace\Unidroid1\Temp\StagingArea\android-libraries\unity-android-resources\res"

stderr[
G:\ZuiZui\Unity3dWorkspace\Unidroid1\Temp\StagingArea\android-libraries\unity-android-resources\res\values\styles.xml:7: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light'.

G:\ZuiZui\Unity3dWorkspace\Unidroid1\Temp\StagingArea\android-libraries\unity-android-resources\res\values-v11\styles.xml:7: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light'.

G:\ZuiZui\Unity3dWorkspace\Unidroid1\Temp\StagingArea\android-libraries\unity-android-resources\res\values-v14\styles.xml:8: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.DarkActionBar'.

]
stdout[
Configurations:
 (default)
 v11
 v14
 mdpi-v4
 hdpi-v4
 xhdpi-v4
 xxhdpi-v4
 w820dp-v13

Files:
  drawable\ic_launcher.png
    Src: (mdpi-v4) G:\ZuiZui\Unity3dWorkspace\Unidroid1\Temp\StagingArea\android-libraries\unity-android-resources\res\drawable-mdpi\ic_launcher.png
    Src: (hdpi-v4) G:\ZuiZui\Unity3dWorkspace\Unidroid1\Temp\StagingArea\android-libraries\unity-android-resources\res\drawable-hdpi\ic_launcher.png
    Src: (xhdpi-v4) G:\ZuiZui\Unity3dWorkspace\Unidroid1\Temp\StagingArea\android-libraries\unity-android-resources\res\drawable-xhdpi\ic_launcher.png
    Src: (xxhdpi-v4) G:\ZuiZui\Unity3dWorkspace\Unidroid1\Temp\StagingArea\android-libraries\unity-android-resources\res\drawable-xxhdpi\ic_launcher.png
  layout\activity_main.xml
    Src: () G:\ZuiZui\Unity3dWorkspace\Unidroid1\Temp\StagingArea\android-libraries\unity-android-resources\res\layout\activity_main.xml
  menu\main.xml
    Src: () G:\ZuiZui\Unity3dWorkspace\Unidroid1\Temp\StagingArea\android-libraries\unity-android-resources\res\menu\main.xml
  values\dimens.xml
    Src: () G:\ZuiZui\Unity3dWorkspace\Unidroid1\Temp\StagingArea\android-libraries\unity-android-resources\res\values\dimens.xml
    Src: (w820dp-v13) G:\ZuiZui\Unity3dWorkspace\Unidroid1\Temp\StagingArea\android-libraries\unity-android-resources\res\values-w820dp\dimens.xml
  values\strings.xml
    Src: () G:\ZuiZui\Unity3dWorkspace\Unidroid1\Temp\StagingArea\android-libraries\unity-android-resources\res\values\strings.xml
  values\styles.xml
    Src: () G:\ZuiZui\Unity3dWorkspace\Unidroid1\Temp\StagingArea\android-libraries\unity-android-resources\res\values\styles.xml
    Src: (v11) G:\ZuiZui\Unity3dWorkspace\Unidroid1\Temp\StagingArea\android-libraries\unity-android-resources\res\values-v11\styles.xml
    Src: (v14) G:\ZuiZui\Unity3dWorkspace\Unidroid1\Temp\StagingArea\android-libraries\unity-android-resources\res\values-v14\styles.xml
  AndroidManifest.xml
    Src: () AndroidManifest.xml

Resource Dirs:
  Type drawable
    drawable\ic_launcher.png
      Src: (mdpi-v4) G:\ZuiZui\Unity3dWorkspace\Unidroid1\Temp\StagingArea\android-libraries\unity-android-resources\res\drawable-mdpi\ic_launcher.png
      Src: (hdpi-v4) G:\ZuiZui\Unity3dWorkspace\Unidroid1\Temp\StagingArea\android-libraries\unity-android-resources\res\drawable-hdpi\ic_launcher.png
      Src: (xhdpi-v4) G:\ZuiZui\Unity3dWorkspace\Unidroid1\Temp\StagingArea\android-libraries\unity-android-resources\res\drawable-xhdpi\ic_launcher.png
      Src: (xxhdpi-v4) G:\ZuiZui\Unity3dWorkspace\Unidroid1\Temp\StagingArea\android-libraries\unity-android-resources\res\drawable-xxhdpi\ic_launcher.png
  Type layout
    layout\activity_main.xml
      Src: () G:\ZuiZui\Unity3dWorkspace\Unidroid1\Temp\StagingArea\android-libraries\unity-android-resources\res\layout\activity_main.xml
  Type menu
    menu\main.xml
      Src: () G:\ZuiZui\Unity3dWorkspace\Unidroid1\Temp\StagingArea\android-libraries\unity-android-resources\res\menu\main.xml
  Type values
    values\dimens.xml
      Src: () G:\ZuiZui\Unity3dWorkspace\Unidroid1\Temp\StagingArea\android-libraries\unity-android-resources\res\values\dimens.xml
      Src: (w820dp-v13) G:\ZuiZui\Unity3dWorkspace\Unidroid1\Temp\StagingArea\android-libraries\unity-android-resources\res\values-w820dp\dimens.xml
    values\strings.xml
      Src: () G:\ZuiZui\Unity3dWorkspace\Unidroid1\Temp\StagingArea\android-libraries\unity-android-resources\res\values\strings.xml
    values\styles.xml
      Src: () G:\ZuiZui\Unity3dWorkspace\Unidroid1\Temp\StagingArea\android-libraries\unity-android-resources\res\values\styles.xml
      Src: (v11) G:\ZuiZui\Unity3dWorkspace\Unidroid1\Temp\StagingArea\android-libraries\unity-android-resources\res\values-v11\styles.xml
      Src: (v14) G:\ZuiZui\Unity3dWorkspace\Unidroid1\Temp\StagingArea\android-libraries\unity-android-resources\res\values-v14\styles.xml
Including resources from package: G:\ZuiZui\sdk\platforms\android-24\android.jar
applyFileOverlay for drawable
trying overlaySet Key=app_banner.png
trying overlaySet Key=app_icon.png
applyFileOverlay for layout
applyFileOverlay for anim
applyFileOverlay for animator
applyFileOverlay for interpolator
applyFileOverlay for transition
applyFileOverlay for xml
applyFileOverlay for raw
applyFileOverlay for color
applyFileOverlay for menu
applyFileOverlay for mipmap
Processing image: res\drawable-xhdpi\app_banner.png
Processing image: res\drawable-mdpi\app_icon.png
Processing image: G:\ZuiZui\Unity3dWorkspace\Unidroid1\Temp\StagingArea\android-libraries\unity-android-resources\res\drawable-mdpi\ic_launcher.png
Processing image: G:\ZuiZui\Unity3dWorkspace\Unidroid1\Temp\StagingArea\android-libraries\unity-android-resources\res\drawable-hdpi\ic_launcher.png
    (processed image G:\ZuiZui\Unity3dWorkspace\Unidroid1\Temp\StagingArea\android-libraries\unity-android-resources\res\drawable-mdpi\ic_launcher.png: 82% size of source)
Processing image: G:\ZuiZui\Unity3dWorkspace\Unidroid1\Temp\StagingArea\android-libraries\unity-android-resources\res\drawable-xhdpi\ic_launcher.png
    (processed image G:\ZuiZui\Unity3dWorkspace\Unidroid1\Temp\StagingArea\android-libraries\unity-android-resources\res\drawable-hdpi\ic_launcher.png: 77% size of source)
Processing image: G:\ZuiZui\Unity3dWorkspace\Unidroid1\Temp\StagingArea\android-libraries\unity-android-resources\res\drawable-xxhdpi\ic_launcher.png
    (processed image res\drawable-mdpi\app_icon.png: 90% size of source)
    (processed image res\drawable-xhdpi\app_banner.png: 93% size of source)
    (processed image G:\ZuiZui\Unity3dWorkspace\Unidroid1\Temp\StagingArea\android-libraries\unity-android-resources\res\drawable-xhdpi\ic_launcher.png: 74% size of source)
    (processed image G:\ZuiZui\Unity3dWorkspace\Unidroid1\Temp\StagingArea\android-libraries\unity-android-resources\res\drawable-xxhdpi\ic_launcher.png: 72% size of source)
    (new resource id app_banner from xhdpi-v4\drawable\app_banner.png #generated)
    (new resource id app_icon from mdpi-v4\drawable\app_icon.png #generated)
    (new resource id ic_launcher from mdpi-v4\drawable\ic_launcher.png #generated)
    (new resource id ic_launcher from hdpi-v4\drawable\ic_launcher.png #generated)
    (new resource id ic_launcher from xhdpi-v4\drawable\ic_launcher.png #generated)
    (new resource id ic_launcher from xxhdpi-v4\drawable\ic_launcher.png #generated)
    (new resource id activity_main from G:\ZuiZui\Unity3dWorkspace\Unidroid1\Temp\StagingArea\android-libraries\unity-android-resources\res\layout\activity_main.xml)
    (new resource id main from G:\ZuiZui\Unity3dWorkspace\Unidroid1\Temp\StagingArea\android-libraries\unity-android-resources\res\menu\main.xml)
]
exit code: 1
UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
UnityEditor.Android.PostProcessor.Tasks.TasksCommon.Exec (System.String command, System.String args, System.String workingdir, System.String errorMsg, Int32 retriesOnFailure)
UnityEditor.HostView:OnGUI()

 

[展开全文]

unity3D专案设定:

1、file》build Settings》Player Setttings

2、android中jar导入的结构

unity3D中目录结构:

Plugins

       Android

             android manifest.xml

            bin:放导出的jar包

            res:放置资源文件

[展开全文]

unity3D专案建立:

1、导入unitydata》libs

2、MainActivity中继承UnityPlayerActivity

3、定义方法显示:

public void showToast(String msg){

Toast.makeText(this,msg,Toast.).show();

}

[展开全文]

 a 的 lineLayout.weight  a 

 b 的 LineLayout.weight b 

a 、 b的大小 a*屏幕大小/(a+b) 、b*(屏幕大小)/(a+b)  

 

[展开全文]

运行模拟器(一般用真机调试)

[展开全文]

void OnGUI()

{

  if(GUILayout.Button(new Rect(100,100,100,100),"Toast"))

{

AndroidJavaClass jc  = new AndroidJavaClass("com.unity3d.player.UnityPlayer");

AndroidJavaObject jo = jc.GetStatic<AndroidJavaClass>("currentActivity");

jo.call("showToast","Unity call java");

}

}

[展开全文]

失败的原因 是因为包名和Android的package名不同。

hello world 的原因。

注释掉SetContextVeiw(R.Layout.Activity_main)

[展开全文]

建立目录Plugins -》 Android ->bin 、 res.

AndroidManifest.xml 放到Android文件夹下面

[展开全文]

导出jar文件。

仅仅导出src文件

[展开全文]

把unity的库文件拖进eclipse的lib里面。

[展开全文]

C:\Program Files\Unity\Editor\Data\PlaybackEngines\androidplayer\release\bin

[展开全文]

授课教师

努力的程序員

课程特色

视频(36)
下载资料(4)