AS&Unity交互问题

时间:2022-09-18 21:13:10
AS&unity交互时最后用手机build and run出现问题报错如下

AS&Unity交互问题

问题(1)

UnityEditor.BuildPlayerWindow+BuildMethodException: Build failed with errors.
  at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (BuildPlayerOptions options) [0x001b9] in C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindowBuildMethods.cs:162 
  at UnityEditor.BuildPlayerWindow.CallBuildMethods (Boolean askForBuildLocation, BuildOptions defaultBuildOptions) [0x00050] in C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindowBuildMethods.cs:83 
UnityEditor.HostView:OnGUI()  






问题(2):

CommandInvokationFailure: Failed to re-package resources.
C:\Users\HS\AppData\Local\Android\Sdk\build-tools\26.0.1\aapt.exe package --auto-add-overlay -v -f -m -J "gen" -M "AndroidManifest.xml" -S "res" -I "C:/Users/HS/AppData/Local/Android/Sdk\platforms\android-23\android.jar" -F bin/resources.ap_ --extra-packages com.emilyujieli.hs.exporttounity -S "F:\unityproject\New Unity Project\Temp\StagingArea\android-libraries\app-debug\res"

stderr[
F:\unityproject\New Unity Project\Temp\StagingArea\android-libraries\app-debug\res\values\values.xml:7: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.DarkActionBar'.

F:\unityproject\New Unity Project\Temp\StagingArea\android-libraries\app-debug\res\values\values.xml:11: error: Error: No resource found that matches the given name: attr 'colorAccent'.

F:\unityproject\New Unity Project\Temp\StagingArea\android-libraries\app-debug\res\values\values.xml:9: error: Error: No resource found that matches the given name: attr 'colorPrimary'.

F:\unityproject\New Unity Project\Temp\StagingArea\android-libraries\app-debug\res\values\values.xml:10: error: Error: No resource found that matches the given name: attr 'colorPrimaryDark'.

]
stdout[
Configurations:
 (default)
 mdpi-v4
 hdpi-v4
 xhdpi-v4
 xxhdpi-v4
 xxxhdpi-v4

Files:
  layout\activity_main.xml
    Src: () F:\unityproject\New Unity Project\Temp\StagingArea\android-libraries\app-debug\res\layout\activity_main.xml
  mipmap\ic_launcher.png
    Src: (mdpi-v4) F:\unityproject\New Unity Project\Temp\StagingArea\android-libraries\app-debug\res\mipmap-mdpi-v4\ic_launcher.png
    Src: (hdpi-v4) F:\unityproject\New Unity Project\Temp\StagingArea\android-libraries\app-debug\res\mipmap-hdpi-v4\ic_launcher.png
    Src: (xhdpi-v4) F:\unityproject\New Unity Project\Temp\StagingArea\android-libraries\app-debug\res\mipmap-xhdpi-v4\ic_launcher.png
    Src: (xxhdpi-v4) F:\unityproject\New Unity Project\Temp\StagingArea\android-libraries\app-debug\res\mipmap-xxhdpi-v4\ic_launcher.png
    Src: (xxxhdpi-v4) F:\unityproject\New Unity Project\Temp\StagingArea\android-libraries\app-debug\res\mipmap-xxxhdpi-v4\ic_launcher.png
  values\values.xml
    Src: () F:\unityproject\New Unity Project\Temp\StagingArea\android-libraries\app-debug\res\values\values.xml
  AndroidManifest.xml
    Src: () AndroidManifest.xml

Resource Dirs:
  Type layout
    layout\activity_main.xml
      Src: () F:\unityproject\New Unity Project\Temp\StagingArea\android-libraries\app-debug\res\layout\activity_main.xml
  Type mipmap
    mipmap\ic_launcher.png
      Src: (mdpi-v4) F:\unityproject\New Unity Project\Temp\StagingArea\android-libraries\app-debug\res\mipmap-mdpi-v4\ic_launcher.png
      Src: (hdpi-v4) F:\unityproject\New Unity Project\Temp\StagingArea\android-libraries\app-debug\res\mipmap-hdpi-v4\ic_launcher.png
      Src: (xhdpi-v4) F:\unityproject\New Unity Project\Temp\StagingArea\android-libraries\app-debug\res\mipmap-xhdpi-v4\ic_launcher.png
      Src: (xxhdpi-v4) F:\unityproject\New Unity Project\Temp\StagingArea\android-libraries\app-debug\res\mipmap-xxhdpi-v4\ic_launcher.png
      Src: (xxxhdpi-v4) F:\unityproject\New Unity Project\Temp\StagingArea\android-libraries\app-debug\res\mipmap-xxxhdpi-v4\ic_launcher.png
  Type values
    values\values.xml
      Src: () F:\unityproject\New Unity Project\Temp\StagingArea\android-libraries\app-debug\res\values\values.xml
Including resources from package: C:\Users\HS\AppData\Local\Android\Sdk\platforms\android-23\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 font
applyFileOverlay for mipmap
Processing image: res\drawable-xhdpi\app_banner.png
Processing image: res\drawable-mdpi\app_icon.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)
    (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)
Processing image: F:\unityproject\New Unity Project\Temp\StagingArea\android-libraries\app-debug\res\mipmap-mdpi-v4\ic_launcher.png
Processing image: F:\unityproject\New Unity Project\Temp\StagingArea\android-libraries\app-debug\res\mipmap-hdpi-v4\ic_launcher.png
Processing image: F:\unityproject\New Unity Project\Temp\StagingArea\android-libraries\app-debug\res\mipmap-xhdpi-v4\ic_launcher.png
Processing image: F:\unityproject\New Unity Project\Temp\StagingArea\android-libraries\app-debug\res\mipmap-xxhdpi-v4\ic_launcher.png
    (processed image F:\unityproject\New Unity Project\Temp\StagingArea\android-libraries\app-debug\res\mipmap-mdpi-v4\ic_launcher.png: 88% size of source)
Processing image: F:\unityproject\New Unity Project\Temp\StagingArea\android-libraries\app-debug\res\mipmap-xxxhdpi-v4\ic_launcher.png
    (processed image F:\unityproject\New Unity Project\Temp\StagingArea\android-libraries\app-debug\res\mipmap-hdpi-v4\ic_launcher.png: 91% size of source)
    (processed image F:\unityproject\New Unity Project\Temp\StagingArea\android-libraries\app-debug\res\mipmap-xhdpi-v4\ic_launcher.png: 90% size of source)
    (processed image F:\unityproject\New Unity Project\Temp\StagingArea\android-libraries\app-debug\res\mipmap-xxhdpi-v4\ic_launcher.png: 90% size of source)
    (processed image F:\unityproject\New Unity Project\Temp\StagingArea\android-libraries\app-debug\res\mipmap-xxxhdpi-v4\ic_launcher.png: 90% size of source)
    (new resource id ic_launcher from mdpi-v4\mipmap\ic_launcher.png #generated)
    (new resource id ic_launcher from hdpi-v4\mipmap\ic_launcher.png #generated)
    (new resource id ic_launcher from xhdpi-v4\mipmap\ic_launcher.png #generated)
    (new resource id ic_launcher from xxhdpi-v4\mipmap\ic_launcher.png #generated)
    (new resource id ic_launcher from xxxhdpi-v4\mipmap\ic_launcher.png #generated)
    (new resource id activity_main from F:\unityproject\New Unity Project\Temp\StagingArea\android-libraries\app-debug\res\layout\activity_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)
UnityEditor.Android.PostProcessor.Tasks.BuildResources.CompileResources (UnityEditor.Android.PostProcessor.PostProcessorContext context)
UnityEditor.Android.PostProcessor.Tasks.BuildResources.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context)
UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context)
UnityEditor.HostView:OnGUI()

2 个解决方案

#1


sdk版本的问题,修改一下 

#2


该回复于2017-10-20 14:23:31被管理员删除

#1


sdk版本的问题,修改一下 

#2


该回复于2017-10-20 14:23:31被管理员删除