Unity 3d android building error - android

When I try to build a .apk file it gives me the following 2 errors:
Error building Player: Win32Exception:
ApplicationName='C:/Users/Teodor/AppData/Local/Android/android-sdk/platforms/android-18\aapt.exe',
CommandLine='package -v -f -m -J gen -M AndroidManifest.xml -S "res"
-I "C:/Users/Teodor/AppData/Local/Android/android-sdk/platforms/android-18\android.jar"
-F bin/resources.ap_', CurrentDirectory='Temp/StagingArea' UnityEditor.HostView:OnGUI()
and
Exception: Error building Player: Win32Exception:
ApplicationName='C:/Users/Teodor/AppData/Local/Android/android-sdk/platforms/android-18\aapt.exe',
CommandLine='package -v -f -m -J gen -M AndroidManifest.xml -S "res"
-I "C:/Users/Teodor/AppData/Local/Android/android-sdk/platforms/android-18\android.jar"
-F bin/resources.ap_', CurrentDirectory='Temp/StagingArea' UnityEditor.BuildPlayerWindow.BuildPlayerWithDefaultSettings (Boolean
askForBuildLocation, BuildOptions forceOptions) (at
C:/BuildAgent/work/842f9557127e852/Editor/Mono/BuildPlayerWindow.cs:367)
UnityEditor.BuildPlayerWindow.GUIBuildButtons (Boolean
enableBuildButton, Boolean enableBuildAndRunButton, Boolean
canInstallInBuildFolder) (at
C:/BuildAgent/work/842f9557127e852/Editor/Mono/BuildPlayerWindow.cs:972)
UnityEditor.BuildPlayerWindow.ShowBuildTargetSettings () (at
C:/BuildAgent/work/842f9557127e852/Editor/Mono/BuildPlayerWindow.cs:953)
UnityEditor.BuildPlayerWindow.OnGUI () (at
C:/BuildAgent/work/842f9557127e852/Editor/Mono/BuildPlayerWindow.cs:726)
System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags
invokeAttr, System.Reflection.Binder binder, System.Object[]
parameters, System.Globalization.CultureInfo culture) Rethrow as
TargetInvocationException: Exception has been thrown by the target of
an invocation. System.Reflection.MonoMethod.Invoke (System.Object obj,
BindingFlags invokeAttr, System.Reflection.Binder binder,
System.Object[] parameters, System.Globalization.CultureInfo culture)
System.Reflection.MethodBase.Invoke (System.Object obj,
System.Object[] parameters) UnityEditor.HostView.Invoke (System.String
methodName, System.Object obj) (at
C:/BuildAgent/work/842f9557127e852/Editor/Mono/GUI/DockArea.cs:225)
UnityEditor.HostView.Invoke (System.String methodName) (at
C:/BuildAgent/work/842f9557127e852/Editor/Mono/GUI/DockArea.cs:218)
UnityEditor.HostView.OnGUI () (at
C:/BuildAgent/work/842f9557127e852/Editor/Mono/GUI/DockArea.cs:119)
and I dont know how to fix it.
In Unity 4.2.0 it doesn't give me any errors, but in 3.4.2 even if the project contains just the main camera and a cube it gives me these errors and the .apk file is not built. How can I resolve this?

Try to search the Android SDK directory for the file aapt.exe. In the later versions, it was moved to android-sdk/build-tools/18.0.0/. Look there and, if you find it, copy it from there to your android-sdk/platforms/android-18 folder.

I had an error very similar to this. What solved it for me was installing the Android SDK Build Tools using the Android SDK Manager.

There are some new Tools introduced in Android sdk -18 so the old unity version will not work
with new android tools as most of them are changed.

Related

Mono.AndroidTools.AdbException: Attempted to read past the end of the stream (on visual studio)

I am building an APP using Xamarin / Visual studio for Mac
I have already a project on an Mac mini.
And now I moved that project to an new iMac.
Compile is good. But when trying deploy to a physical device. It got error
"Mono.AndroidTools.AdbException: Attempted to read past the end of the stream"
If I create a new project on the new iMac. It can deploy to the device.
But my old project can't.
Here is some log. I am now stuck at here....Thank you!
80% ... 32128kb of 40140kb copied
90% ... 36160kb of 40140kb copied
100% ... 40140kb of 40140kb copied
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(579,2): warning ADB1000: Failed to delete package file: One or more errors occurred. (One or more errors occurred. (One or more errors occurred. (device '9f5f1695' not found)))
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(579,2): error ADB1000: Deployment failed
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(579,2): error ADB1000: Mono.AndroidTools.AdbException: Attempted to read past the end of the stream. ---> System.IO.EndOfStreamException: Attempted to read past the end of the stream.
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(579,2): error ADB1000: at Mono.AndroidTools.Util.ReadFullAsyncResult.EndRead (System.IAsyncResult ar) [0x00024] in /Users/builder/azdo/_work/30/s/xamarin-android/external/monodroid/tools/msbuild/external/androidtools/Mono.AndroidTools/Util/StreamExtensions.cs:95
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(579,2): error ADB1000: at Mono.AndroidTools.Adb.AdbSyncClient.FileWrite_OnReadStatus (System.IAsyncResult ar) [0x0000c] in /Users/builder/azdo/_work/30/s/xamarin-android/external/monodroid/tools/msbuild/external/androidtools/Mono.AndroidTools/Adb/AdbSyncClient.cs:619
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(579,2): error ADB1000: --- End of inner exception stack trace ---
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(579,2): error ADB1000: at Mono.AndroidTools.Util.AggregateAsyncResult.CheckError (System.Threading.CancellationToken token) [0x0002a] in /Users/builder/azdo/_work/30/s/xamarin-android/external/monodroid/tools/msbuild/external/androidtools/Mono.AndroidTools/Util/AggregateAsyncResult.cs:72
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(579,2): error ADB1000: at Mono.AndroidTools.Adb.AdbSyncClient.EndPush (System.IAsyncResult result) [0x00006] in /Users/builder/azdo/_work/30/s/xamarin-android/external/monodroid/tools/msbuild/external/androidtools/Mono.AndroidTools/Adb/AdbSyncClient.cs:771
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(579,2): error ADB1000: at System.Threading.Tasks.TaskFactory`1[TResult].FromAsyncCoreLogic (System.IAsyncResult iar, System.Func`2[T,TResult] endFunction, System.Action`1[T] endAction, System.Threading.Tasks.Task`1[TResult] promise, System.Boolean requiresSynchronization) [0x0000f] in /Users/builder/jenkins/workspace/build-package-osx-mono/2020-02/external/bockbuild/builds/mono-x64/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/FutureFactory.cs:534
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(579,2): error ADB1000: --- End of stack trace from previous location where exception was thrown ---
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(579,2): error ADB1000:
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(579,2): error ADB1000: at AndroidDeviceExtensions.PushAndInstallPackage (Mono.AndroidTools.AndroidDevice device, System.String apkFile, System.String packageName, System.Boolean reinstall, Mono.AndroidTools.Adb.AdbProgressReporter notifyProgress, System.Threading.CancellationToken token) [0x0008f] in /Users/builder/azdo/_work/30/s/xamarin-android/external/monodroid/tools/msbuild/external/androidtools/Xamarin.AndroidTools/Devices/AndroidDeviceExtensions.cs:180
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(579,2): error ADB1000: at AndroidDeviceExtensions.PushAndInstallPackage (Mono.AndroidTools.AndroidDevice device, System.String apkFile, System.String packageName, System.Boolean reinstall, Mono.AndroidTools.Adb.AdbProgressReporter notifyProgress, System.Threading.CancellationToken token) [0x003ce] in /Users/builder/azdo/_work/30/s/xamarin-android/external/monodroid/tools/msbuild/external/androidtools/Xamarin.AndroidTools/Devices/AndroidDeviceExtensions.cs:203
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(579,2): error ADB1000: at AndroidDeviceExtensions.InstallSharedRuntimeAsync (Mono.AndroidTools.AndroidDevice device, System.String runtimeFile, Mono.AndroidTools.Adb.AdbProgressReporter progress, System.Threading.CancellationToken token) [0x000ac] in /Users/builder/azdo/_work/30/s/xamarin-android/external/monodroid/tools/msbuild/external/androidtools/Xamarin.AndroidTools/Devices/AndroidDeviceExtensions.cs:433
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(579,2): error ADB1000: at AndroidDeviceExtensions.InstallSharedRuntimeAsync (Mono.AndroidTools.AndroidDevice device, System.Boolean provideFullDebugRuntime, System.Threading.CancellationToken cancellationToken, Xamarin.AndroidTools.IProgressNotifier progressReporter) [0x000ac] in /Users/builder/azdo/_work/30/s/xamarin-android/external/monodroid/tools/msbuild/external/androidtools/Xamarin.AndroidTools/Devices/AndroidDeviceExtensions.cs:630
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(579,2): error ADB1000: at Xamarin.AndroidTools.AndroidDeploySession.CheckAndInstallSharedRuntimeAsync () [0x0009c] in /Users/builder/azdo/_work/30/s/xamarin-android/external/monodroid/tools/msbuild/external/androidtools/Xamarin.AndroidTools/Sessions/AndroidDeploySession.cs:321
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(579,2): error ADB1000: at Xamarin.AndroidTools.AndroidDeploySession.EnsureCorrectSharedRuntimes () [0x000f2] in /Users/builder/azdo/_work/30/s/xamarin-android/external/monodroid/tools/msbuild/external/androidtools/Xamarin.AndroidTools/Sessions/AndroidDeploySession.cs:258
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(579,2): error ADB1000: at Xamarin.AndroidTools.AndroidDeploySession.RunAsync (System.Threading.CancellationToken token) [0x001f9] in /Users/builder/azdo/_work/30/s/xamarin-android/external/monodroid/tools/msbuild/external/androidtools/Xamarin.AndroidTools/Sessions/AndroidDeploySession.cs:198
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(579,2): error ADB1000: at Xamarin.AndroidTools.AndroidDeploySession.RunLoggedAsync (System.Threading.CancellationToken token) [0x0002f] in /Users/builder/azdo/_work/30/s/xamarin-android/external/monodroid/tools/msbuild/external/androidtools/Xamarin.AndroidTools/Sessions/AndroidDeploySession.cs:123
To resolve issue on my Mac I had to type
adb uninstall Mono.Android.DebugRuntime
sometimes when this bug happens adb was disconnecting from device, and had to type also
adb kill-server
UPDATE:
Another apps would sometimes gave me similar error and uninstalling Mono.Android.DebugRuntime didn't help.
I ran out of ideas and factory reset of my macbook did the trick. No more problems with installing app on devices. Sometimes fresh start is the best way :)
I am using Visual Studio 2022, Windows 10,
Having the same error message, changing USB port or USB cable doesn't work,
Run commands doesn't work:
adb uninstall Mono.Android.DebugRuntime
adb kill-server
But restarting the computer WORKS!
This was fixed by reboot the Mac....

Xamarin.Android APK Deployment failed - INSTALL_FAILED_INVALID_APK base.apk code is missing

My Xamarin.Android app can no longer be deployed to an emulator/device. I can compile it successfully and the deployment process is started but in the end it fails. I'm using Visual Studio for Mac and Xamarin.Android:
[INSTALL_FAILED_INVALID_APK: Package couldn't be installed in
/data/app/my.app.bundle.id-agudyKm4Ib_8OheG3_5zmg==: Package
/data/app/my.app.bundle.id-agudyKm4Ib_8OheG3_5zmg==/base.apk code is
missing]
My build configuration is below:
Multi-dex = ON because without it I'm getting the DEX size error
DEX compiler = DX (D8 doesn't work, I'm getting a compilation error that some classes are missing, see below)
Code shrinker = Off (this is a debug build to run on local emulator/device)
This error occurs if I set DEX compiler to D8:
R8 : warning : Missing class: androidx.appcompat.widget.AppCompatEditText (and 10 more similar errors)
missing R8 : error : Compilation can't be completed because some library classes are missing.
The error occurs with all the settings above, this is basically the only configuration I can build my app but unable to deploy it to device:
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(612,2): error ADB0010: Deployment failed
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(612,2): error ADB0010: Mono.AndroidTools.InstallFailedException: Failure [INSTALL_FAILED_INVALID_APK: Package couldn't be installed in /data/app/my.app.bundle.id-agudyKm4Ib_8OheG3_5zmg==: Package /data/app/my.app.bundle.id-agudyKm4Ib_8OheG3_5zmg==/base.apk code is missing]
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(612,2): error ADB0010: at Mono.AndroidTools.Internal.AdbOutputParsing.CheckInstallSuccess (System.String output, System.String packageName) [0x00152] in /Users/runner/runners/2.165.0/work/1/s/xamarin-android/external/monodroid/tools/msbuild/external/androidtools/Mono.AndroidTools/Internal/AdbOutputParsing.cs:341
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(612,2): error ADB0010: at Mono.AndroidTools.AndroidDevice+<>c__DisplayClass95_0.<InstallPackage>b__0 (System.Threading.Tasks.Task`1[TResult] t) [0x00016] in /Users/runner/runners/2.165.0/work/1/s/xamarin-android/external/monodroid/tools/msbuild/external/androidtools/Mono.AndroidTools/AndroidDevice.cs:753
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(612,2): error ADB0010: at System.Threading.Tasks.ContinuationTaskFromResultTask`1[TAntecedentResult].InnerInvoke () [0x00024] in <f9d1b832704f410aa8ec771f4fe80552>:0
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(612,2): error ADB0010: at System.Threading.Tasks.Task.Execute () [0x00000] in /Users/builder/jenkins/workspace/build-package-osx-mono/2019-10/external/bockbuild/builds/mono-x64/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs:2319
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(612,2): error ADB0010: --- End of stack trace from previous location where exception was thrown ---
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(612,2): error ADB0010:
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(612,2): error ADB0010: at AndroidDeviceExtensions.PushAndInstallPackage (Mono.AndroidTools.AndroidDevice device, System.String apkFile, System.String packageName, System.Boolean reinstall, Mono.AndroidTools.Adb.AdbProgressReporter notifyProgress, System.Threading.CancellationToken token) [0x00189] in /Users/runner/runners/2.165.0/work/1/s/xamarin-android/external/monodroid/tools/msbuild/external/androidtools/Xamarin.AndroidTools/Devices/AndroidDeviceExtensions.cs:187
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(612,2): error ADB0010: at AndroidDeviceExtensions.PushAndInstallPackage (Mono.AndroidTools.AndroidDevice device, System.String apkFile, System.String packageName, System.Boolean reinstall, Mono.AndroidTools.Adb.AdbProgressReporter notifyProgress, System.Threading.CancellationToken token) [0x003df] in /Users/runner/runners/2.165.0/work/1/s/xamarin-android/external/monodroid/tools/msbuild/external/androidtools/Xamarin.AndroidTools/Devices/AndroidDeviceExtensions.cs:203
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(612,2): error ADB0010: at Xamarin.AndroidTools.AndroidDeploySession.InstallPackage () [0x003be] in /Users/runner/runners/2.165.0/work/1/s/xamarin-android/external/monodroid/tools/msbuild/external/androidtools/Xamarin.AndroidTools/Sessions/AndroidDeploySession.cs:433
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(612,2): error ADB0010: at Xamarin.AndroidTools.AndroidDeploySession.RunAsync (System.Threading.CancellationToken token) [0x003ae] in /Users/runner/runners/2.165.0/work/1/s/xamarin-android/external/monodroid/tools/msbuild/external/androidtools/Xamarin.AndroidTools/Sessions/AndroidDeploySession.cs:217
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(612,2): error ADB0010: at Xamarin.AndroidTools.AndroidDeploySession.RunLoggedAsync (System.Threading.CancellationToken token) [0x0002f] in /Users/runner/runners/2.165.0/work/1/s/xamarin-android/external/monodroid/tools/msbuild/external/androidtools/Xamarin.AndroidTools/Sessions/AndroidDeploySession.cs:119
Not a Xamarin expert but if you can see the native files, can you check gradle.properties if it has:
android.useAndroidX=true
android.enableJetifier=true
Also inside the build.gradle of the native files (app directory) you should have:
implementation "androidx.appcompat:appcompat:1.1.0"
Unfortunately the I wasn't able to make it work with DEX Compiler = DX, and when you switch to D8, the migration to AndroidX is required. In terms of Xamarin, you have to add the following package and all additional requested dependencies:
<PackageReference Include="Xamarin.AndroidX.AppCompat">
<Version>1.1.0</Version>
</PackageReference>
Another issue I hit was the usage of old packages.config file which have to be migrated to the project PackageReference. This is not supported from Visual Studio for Mac so you have to switch to Windows to accomplish that tasks. A lot of extra steps just to compile an application in support.

Unity 3D - CommandInvokationFailure: Failed to re-package resources

Stuck in a problem from past two days, Also re-installed the sdk but no success.
1. Checked the Build-Tools Folder , there is a folder: 27.0.3.
2. I am using Unity 2018.1.1f1.
3. Have been using JDK: "jdk1.8.0_172".
4. Working on Windows 10.
Unable to understand the reason.
CommandInvokationFailure: Failed to re-package resources.
C:\Users\Amit\AppData\Local\Android\sdk\build-tools\27.0.3\aapt.exe package --auto-add-overlay -v -f -m -J "gen" -M "AndroidManifest.xml" -S "res" -I "C:/Users/Amit/AppData/Local/Android/sdk\platforms\android-27\android.jar" -F bin/resources.ap_ --extra-packages android.arch.core:android.arch.lifecycle.livedata.core:android.arch.lifecycle:android.arch.lifecycle.viewmodel:com.clevertap.unity:android.support.graphics.drawable.animated:android.support.v7.appcompat:android.support.asynclayoutinflater:android.support.v7.cardview:android.support.coordinatorlayout:android.support.cursoradapter:android.support.customtabs:android.support.customview:android.support.design:android.support.design.animation:android.support.design.bottomappbar:android.support.design.bottomnavigation:android.support.design.bottomsheet:android.support.design.button:android.support.design.canvas:android.support.design.card:android.support.design.chip:android.support.design.circularreveal:android.support.design.circularreveal.cardview:android.support.design.circularreveal.coordinatorlayout:android.support.design.color:android.support.design.dialog:android.support.design.drawable:android.support.design.expandable:android.support.design.floatingactionbutton:android.support.design.internal:android.support.design.math:android.support.design.navigation:android.support.design.resources:android.support.design.ripple:android.support.design.shape:android.support.design.snackbar:android.support.design.stateful:android.support.design.textfield:android.support.design.textfield:android.support.design.theme:android.support.design.transformation:android.support.design.typography:android.support.design.widget:android.support.documentfile:android.support.drawerlayout:android.support.interpolator:android.support.loader:android.support.localbroadcastmanager:android.support.print:android.support.v7.recyclerview:android.support.slidingpanelayout:android.support.compat:android.support.coreui:android.support.coreutils:android.support.fragment:android.support.mediacompat:android.support.v4:android.support.graphics.drawable:android.support.swiperefreshlayout:android.support.transition:android.support.viewpager:com.google.android.gms.auth.api:com.google.android.gms.auth.api.phone:com.google.android.gms.auth:com.google.android.gms.base:com.google.android.gms.common:com.google.android.gms.gcm:com.google.android.gms.iid:com.google.android.gms.stats:com.google.android.gms.tasks:com.facebook:com.facebook.android:in.locomotion.plugins.login:com.aurodo.vehicles4d.resources -S "C:\Users\Amit\Desktop\Vehicles_Unity\Anwar\10-april\Vehicles10Apr2018\Vehicles\Temp\StagingArea\android-libraries\android.arch.core.runtime-1.1.0\res" -S "C:\Users\Amit\Desktop\Vehicles_Unity\Anwar\10-april\Vehicles10Apr2018\Vehicles\Temp\StagingArea\android-libraries\android.arch.lifecycle.livedata-core-1.1.0\res" -S "C:\Users\Amit\Desktop\Vehicles_Unity\Anwar\10-april\Vehicles10Apr2018\Vehicles\Temp\StagingArea\android-libraries\android.arch.lifecycle.runtime-1.1.0\res" -S "C:\Users\Amit\Desktop\Vehicles_Unity\Anwar\10-april\Vehicles10Apr2018\Vehicles\Temp\StagingArea\android-libraries\android.arch.lifecycle.viewmodel-1.1.0\res" -S "C:\Users\Amit\Desktop\Vehicles_Unity\Anwar\10-april\Vehicles10Apr2018\Vehicles\Temp\StagingArea\android-libraries\clevertapsdk-unity\res" -S "C:\Users\Amit\Desktop\Vehicles_Unity\Anwar\10-april\Vehicles10Apr2018\Vehicles\Temp\StagingArea\android-libraries\com.android.support.animated-vector-drawable-28.0.0-alpha1\res" -S "C:\Users\Amit\Desktop\Vehicles_Unity\Anwar\10-april\Vehicles10Apr2018\Vehicles\Temp\StagingArea\android-libraries\com.android.support.appcompat-v7-28.0.0-alpha1\res" -S "C:\Users\Amit\Desktop\Vehicles_Unity\Anwar\10-april\Vehicles10Apr2018\Vehicles\Temp\StagingArea\android-libraries\com.android.support.asynclayoutinflater-28.0.0-alpha1\res" -S "C:\Users\Amit\Desktop\Vehicles_Unity\Anwar\10-april\Vehicles10Apr2018\Vehicles\Temp\StagingArea\android-libraries\com.android.support.cardview-v7-28.0.0-alpha1\res" -S "C:\Users\Amit\Desktop\Vehicles_Unity\Anwar\10-april\Vehicles10Apr2018\Vehicles\Temp\StagingArea\android-libraries\com.android.support.coordinatorlayout-28.0.0-alpha1\res" -S "C:\Users\Amit\Desktop\Vehicles_Unity\Anwar\10-april\Vehicles10Apr2018\Vehicles\Temp\StagingArea\android-libraries\com.android.support.cursoradapter-28.0.0-alpha1\res" -S "C:\Users\Amit\Desktop\Vehicles_Unity\Anwar\10-april\Vehicles10Apr2018\Vehicles\Temp\StagingArea\android-libraries\com.android.support.customtabs-28.0.0-alpha1\res" -S "C:\Users\Amit\Desktop\Vehicles_Unity\Anwar\10-april\Vehicles10Apr2018\Vehicles\Temp\StagingArea\android-libraries\com.android.support.customview-28.0.0-alpha1\res" -S "C:\Users\Amit\Desktop\Vehicles_Unity\Anwar\10-april\Vehicles10Apr2018\Vehicles\Temp\StagingArea\android-libraries\com.android.support.design-28.0.0-alpha1\res" -S "C:\Users\Amit\Desktop\Vehicles_Unity\Anwar\10-april\Vehicles10Apr2018\Vehicles\Temp\StagingArea\android-libraries\com.android.support.design-animation-28.0.0-alpha1\res" -S "C:\Users\Amit\Desktop\Vehicles_Unity\Anwar\10-april\Vehicles10Apr2018\Vehicles\Temp\StagingArea\android-libraries\com.android.support.design-bottomappbar-28.0.0-alpha1\res" -S "C:\Users\Amit\Desktop\Vehicles_Unity\Anwar\10-april\Vehicles10Apr2018\Vehicles\Temp\StagingArea\android-libraries\com.android.support.design-bottomnavigation-28.0.0-alpha1\res" -S "C:\Users\Amit\Desktop\Vehicles_Unity\Anwar\10-april\Vehicles10Apr2018\Vehicles\Temp\StagingArea\android-libraries\com.android.support.design-bottomsheet-28.0.0-alpha1\res" -S "C:\Users\Amit\Desktop\Vehicles_Unity\Anwar\10-april\Vehicles10Apr2018\Vehicles\Temp\StagingArea\android-libraries\com.android.support.design-button-28.0.0-alpha1\res" -S "C:\Users\Amit\Desktop\Vehicles_Unity\Anwar\10-april\Vehicles10Apr2018\Vehicles\Temp\StagingArea\android-libraries\com.android.support.design-canvas-28.0.0-alpha1\res" -S "C:\Users\Amit\Desktop\Vehicles_Unity\Anwar\10-april\Vehicles10Apr2018\Vehicles\Temp\StagingArea\android-libraries\com.android.support.design-card-28.0.0-alpha1\res" -S "C:\Users\Amit\Desktop\Vehicles_Unity\Anwar\10-april\Vehicles10Apr2018\Vehicles\Temp\StagingArea\android-libraries\com.android.support.design-chip-28.0.0-alpha1\res" -S "C:\Users\Amit\Desktop\Vehicles_Unity\Anwar\10-april\Vehicles10Apr2018\Vehicles\Temp\StagingArea\android-libraries\com.android.support.design-circularreveal-28.0.0-alpha1\res" -S "C:\Users\Amit\Desktop\Vehicles_Unity\Anwar\10-april\Vehicles10Apr2018\Vehicles\Temp\StagingArea\android-libraries\com.android.support.design-circularreveal-cardview-28.0.0-alpha1\res" -S "C:\Users\Amit\Desktop\Vehicles_Unity\Anwar\10-april\Vehicles10Apr2018\Vehicles\Temp\StagingArea\android-libraries\com.android.support.design-circularreveal-coordinatorlayout-28.0.0-alpha1\res" -S "C:\Users\Amit\Desktop\Vehicles_Unity\Anwar\10-april\Vehicles10Apr2018\Vehicles\Temp\StagingArea\android-libraries\com.android.support.design-color-28.0.0-alpha1\res" -S "C:\Users\Amit\Desktop\Vehicles_Unity\Anwar\10-april\Vehicles10Apr2018\Vehicles\Temp\StagingArea\android-libraries\com.android.support.design-dialog-28.0.0-alpha1\res" -S "C:\Users\Amit\Desktop\Vehicles_Unity\Anwar\10-april\Vehicles10Apr2018\Vehicles\Temp\StagingArea\android-libraries\com.android.support.design-drawable-28.0.0-alpha1\res" -S "C:\Users\Amit\Desktop\Vehicles_Unity\Anwar\10-april\Vehicles10Apr2018\Vehicles\Temp\StagingArea\android-libraries\com.android.support.design-expandable-28.0.0-alpha1\res" -S "C:\Users\Amit\Desktop\Vehicles_Unity\Anwar\10-april\Vehicles10Apr2018\Vehicles\Temp\StagingArea\android-libraries\com.android.support.design-floatingactionbutton-28.0.0-alpha1\res" -S "C:\Users\Amit\Desktop\Vehicles_Unity\Anwar\10-april\Vehicles10Apr2018\Vehicles\Temp\StagingArea\android-libraries\com.android.support.design-internal-28.0.0-alpha1\res" -S "C:\Users\Amit\Desktop\Vehicles_Unity\Anwar\10-april\Vehicles10Apr2018\Vehicles\Temp\StagingArea\android-libraries\com.android.support.design-math-28.0.0-alpha1\res" -S "C:\Users\Amit\Desktop\Vehicles_Unity\Anwar\10-april\Vehicles10Apr2018\Vehicles\Temp\StagingArea\android-libraries\com.android.support.design-navigation-28.0.0-alpha1\res" -S "C:\Users\Amit\Desktop\Vehicles_Unity\Anwar\10-april\Vehicles10Apr2018\Vehicles\Temp\StagingArea\android-libraries\com.android.support.design-resources-28.0.0-alpha1\res" -S "C:\Users\Amit\Desktop\Vehicles_Unity\Anwar\10-april\Vehicles10Apr2018\Vehicles\Temp\StagingArea\android-libraries\com.android.support.design-ripple-28.0.0-alpha1\res" -S "C:\Users\Amit\Desktop\Vehicles_Unity\Anwar\10-april\Vehicles10Apr2018\Vehicles\Temp\StagingArea\android-libraries\com.android.support.design-shape-28.0.0-alpha1\res" -S "C:\Users\Amit\Desktop\Vehicles_Unity\Anwar\10-april\Vehicles10Apr2018\Vehicles\Temp\StagingArea\android-libraries\com.android.support.design-snackbar-28.0.0-alpha1\res" -S "C:\Users\Amit\Desktop\Vehicles_Unity\Anwar\10-april\Vehicles10Apr2018\Vehicles\Temp\StagingArea\android-libraries\com.android.support.design-stateful-28.0.0-alpha1\res" -S "C:\Users\Amit\Desktop\Vehicles_Unity\Anwar\10-april\Vehicles10Apr2018\Vehicles\Temp\StagingArea\android-libraries\com.android.support.design-tabs-28.0.0-alpha1\res" -S "C:\Users\Amit\Desktop\Vehicles_Unity\Anwar\10-april\Vehicles10Apr2018\Vehicles\Temp\StagingArea\android-libraries\com.android.support.design-textfield-28.0.0-alpha1\res" -S "C:\Users\Amit\Desktop\Vehicles_Unity\Anwar\10-april\Vehicles10Apr2018\Vehicles\Temp\StagingArea\android-libraries\com.android.support.design-theme-28.0.0-alpha1\res" -S "C:\Users\Amit\Desktop\Vehicles_Unity\Anwar\10-april\Vehicles10Apr2018\Vehicles\Temp\StagingArea\android-libraries\com.android.support.design-transformation-28.0.0-alpha1\res" -S "C:\Users\Amit\Desktop\Vehicles_Unity\Anwar\10-april\Vehicles10Apr2018\Vehicles\Temp\StagingArea\android-libraries\com.android.support.design-typography-28.0.0-alpha1\res" -S "C:\Users\Amit\Desktop\Vehicles_Unity\Anwar\10-april\Vehicles10Apr2018\Vehicles\Temp\StagingArea\android-libraries\com.android.support.design-widget-28.0.0-alpha1\res" -S "C:\Users\Amit\Desktop\Vehicles_Unity\Anwar\10-april\Vehicles10Apr2018\Vehicles\Temp\StagingArea\android-libraries\com.android.support.documentfile-28.0.0-alpha1\res" -S "C:\Users\Amit\Desktop\Vehicles_Unity\Anwar\10-april\Vehicles10Apr2018\Vehicles\Temp\StagingArea\android-libraries\com.android.support.drawerlayout-28.0.0-alpha1\res" -S "C:\Users\Amit\Desktop\Vehicles_Unity\Anwar\10-april\Vehicles10Apr2018\Vehicles\Temp\StagingArea\android-libraries\com.android.support.interpolator-28.0.0-alpha1\res" -S "C:\Users\Amit\Desktop\Vehicles_Unity\Anwar\10-april\Vehicles10Apr2018\Vehicles\Temp\StagingArea\android-libraries\com.android.support.loader-28.0.0-alpha1\res" -S "C:\Users\Amit\Desktop\Vehicles_Unity\Anwar\10-april\Vehicles10Apr2018\Vehicles\Temp\StagingArea\android-libraries\com.android.support.localbroadcastmanager-28.0.0-alpha1\res" -S "C:\Users\Amit\Desktop\Vehicles_Unity\Anwar\10-april\Vehicles10Apr2018\Vehicles\Temp\StagingArea\android-libraries\com.android.support.print-28.0.0-alpha1\res" -S "C:\Users\Amit\Desktop\Vehicles_Unity\Anwar\10-april\Vehicles10Apr2018\Vehicles\Temp\StagingArea\android-libraries\com.android.support.recyclerview-v7-28.0.0-alpha1\res" -S "C:\Users\Amit\Desktop\Vehicles_Unity\Anwar\10-april\Vehicles10Apr2018\Vehicles\Temp\StagingArea\android-libraries\com.android.support.slidingpanelayout-28.0.0-alpha1\res" -S "C:\Users\Amit\Desktop\Vehicles_Unity\Anwar\10-april\Vehicles10Apr2018\Vehicles\Temp\StagingArea\android-libraries\com.android.support.support-compat-28.0.0-alpha1\res" -S "C:\Users\Amit\Desktop\Vehicles_Unity\Anwar\10-april\Vehicles10Apr2018\Vehicles\Temp\StagingArea\android-libraries\com.android.support.support-core-ui-28.0.0-alpha1\res" -S "C:\Users\Amit\Desktop\Vehicles_Unity\Anwar\10-april\Vehicles10Apr2018\Vehicles\Temp\StagingArea\android-libraries\com.android.support.support-core-utils-28.0.0-alpha1\res" -S "C:\Users\Amit\Desktop\Vehicles_Unity\Anwar\10-april\Vehicles10Apr2018\Vehicles\Temp\StagingArea\android-libraries\com.android.support.support-fragment-28.0.0-alpha1\res" -S "C:\Users\Amit\Desktop\Vehicles_Unity\Anwar\10-april\Vehicles10Apr2018\Vehicles\Temp\StagingArea\android-libraries\com.android.support.support-media-compat-28.0.0-alpha1\res" -S "C:\Users\Amit\Desktop\Vehicles_Unity\Anwar\10-april\Vehicles10Apr2018\Vehicles\Temp\StagingArea\android-libraries\com.android.support.support-v4-28.0.0-alpha1\res" -S "C:\Users\Amit\Desktop\Vehicles_Unity\Anwar\10-april\Vehicles10Apr2018\Vehicles\Temp\StagingArea\android-libraries\com.android.support.support-vector-drawable-28.0.0-alpha1\res" -S "C:\Users\Amit\Desktop\Vehicles_Unity\Anwar\10-april\Vehicles10Apr2018\Vehicles\Temp\StagingArea\android-libraries\com.android.support.swiperefreshlayout-28.0.0-alpha1\res" -S "C:\Users\Amit\Desktop\Vehicles_Unity\Anwar\10-april\Vehicles10Apr2018\Vehicles\Temp\StagingArea\android-libraries\com.android.support.transition-28.0.0-alpha1\res" -S "C:\Users\Amit\Desktop\Vehicles_Unity\Anwar\10-april\Vehicles10Apr2018\Vehicles\Temp\StagingArea\android-libraries\com.android.support.viewpager-28.0.0-alpha1\res" -S "C:\Users\Amit\Desktop\Vehicles_Unity\Anwar\10-april\Vehicles10Apr2018\Vehicles\Temp\StagingArea\android-libraries\com.google.android.gms.play-services-auth-15.0.1\res" -S "C:\Users\Amit\Desktop\Vehicles_Unity\Anwar\10-april\Vehicles10Apr2018\Vehicles\Temp\StagingArea\android-libraries\com.google.android.gms.play-services-base-15.0.1\res" -S "C:\Users\Amit\Desktop\Vehicles_Unity\Anwar\10-april\Vehicles10Apr2018\Vehicles\Temp\StagingArea\android-libraries\com.google.android.gms.play-services-basement-15.0.1\res" -S "C:\Users\Amit\Desktop\Vehicles_Unity\Anwar\10-april\Vehicles10Apr2018\Vehicles\Temp\StagingArea\android-libraries\com.google.android.gms.play-services-gcm-15.0.1\res" -S "C:\Users\Amit\Desktop\Vehicles_Unity\Anwar\10-april\Vehicles10Apr2018\Vehicles\Temp\StagingArea\android-libraries\facebook-android-sdk-4.23.0\res" -S "C:\Users\Amit\Desktop\Vehicles_Unity\Anwar\10-april\Vehicles10Apr2018\Vehicles\Temp\StagingArea\android-libraries\facebook-android-wrapper-7.10.1\res" -S "C:\Users\Amit\Desktop\Vehicles_Unity\Anwar\10-april\Vehicles10Apr2018\Vehicles\Temp\StagingArea\android-libraries\google-login-kit\res" -S "C:\Users\Amit\Desktop\Vehicles_Unity\Anwar\10-april\Vehicles10Apr2018\Vehicles\Temp\StagingArea\android-libraries\unity-android-resources\res"
stderr[
C:\Users\Amit\Desktop\Vehicles_Unity\Anwar\10-april\Vehicles10Apr2018\Vehicles\Temp\StagingArea\android-libraries\com.android.support.design-textfield-28.0.0-alpha1\res\drawable-v21\avd_hide_password.xml:22: note: generating nested resource com.aurodo.vehicles4d:drawable/avd_hide_password_1
C:\Users\Amit\Desktop\Vehicles_Unity\Anwar\10-april\Vehicles10Apr2018\Vehicles\Temp\StagingArea\android-libraries\com.android.support.design-textfield-28.0.0-alpha1\res\drawable-v21\avd_hide_password.xml:57: note: generating nested resource com.aurodo.vehicles4d:drawable/avd_hide_password_2
C:\Users\Amit\Desktop\Vehicles_Unity\Anwar\10-april\Vehicles10Apr2018\Vehicles\Temp\StagingArea\android-libraries\com.android.support.design-textfield-28.0.0-alpha1\res\drawable-v21\avd_hide_password.xml:73: note: generating nested resource com.aurodo.vehicles4d:drawable/avd_hide_password_3
C:\Users\Amit\Desktop\Vehicles_Unity\Anwar\10-april\Vehicles10Apr2018\Vehicles\Temp\StagingArea\android-libraries\com.android.support.design-textfield-28.0.0-alpha1\res\drawable-v21\avd_show_password.xml:22: note: generating nested resource com.aurodo.vehicles4d:drawable/avd_show_password_1
C:\Users\Amit\Desktop\Vehicles_Unity\Anwar\10-april\Vehicles10Apr2018\Vehicles\Temp\StagingArea\android-libraries\com.android.support.design-textfield-28.0.0-alpha1\res\drawable-v21\avd_show_password.xml:56: note: generating nested resource com.aurodo.vehicles4d:drawable/avd_show_password_2
C:\Users\Amit\Desktop\Vehicles_Unity\Anwar\10-april\Vehicles10Apr2018\Vehicles\Temp\StagingArea\android-libraries\com.android.support.design-textfield-28.0.0-alpha1\res\drawable-v21\avd_show_password.xml:72: note: generating nested resource com.aurodo.vehicles4d:drawable/avd_show_password_3
Failed to generate resource table for split ''
C:\Users\Amit\Desktop\Vehicles_Unity\Anwar\10-april\Vehicles10Apr2018\Vehicles\Temp\StagingArea\android-libraries\com.android.support.appcompat-v7-28.0.0-alpha1\res\values-v28\values-v28.xml:7: error: Error: No resource found that matches the given name (at 'dialogCornerRadius' with value '?android:attr/dialogCornerRadius').
]
stdout[
Configurations:
(default)
Files:
drawable\close.png
Src: () C:\Users\Amit\Desktop\Vehicles_Unity\Anwar\10-april\Vehicles10Apr2018\Vehicles\Temp\StagingArea\android-libraries\unity-android-resources\res\drawable\close.png
AndroidManifest.xml
Src: () AndroidManifest.xml
Resource Dirs:
Type drawable
drawable\close.png
Src: () C:\Users\Amit\Desktop\Vehicles_Unity\Anwar\10-april\Vehicles10Apr2018\Vehicles\Temp\StagingArea\android-libraries\unity-android-resources\res\drawable\close.png
Including resources from package: C:\Users\Amit\AppData\Local\Android\sdk\platforms\android-27\android.jar
applyFileOverlay for drawable
trying overlaySet Key=com_facebook_auth_dialog_background.xml
trying overlaySet Key=com_facebook_auth_dialog_cancel_background.xml
trying overlaySet Key=com_facebook_auth_dialog_header_background.xml
Processing image: C:\Users\Amit\Desktop\Vehicles_Unity\Anwar\10-april\Vehicles10Apr2018\Vehicles\Temp\StagingArea\android-libraries\unity-android-resources\res\drawable\close.png
(processed image C:\Users\Amit\Desktop\Vehicles_Unity\Anwar\10-april\Vehicles10Apr2018\Vehicles\Temp\StagingArea\android-libraries\unity-android-resources\res\drawable\close.png: 45% size of source)
(new resource id design_layout_tab_text from C:\Users\Amit\Desktop\Vehicles_Unity\Anwar\10-april\Vehicles10Apr2018\Vehicles\Temp\StagingArea\android-libraries\com.android.support.design-tabs-28.0.0-alpha1\res\layout\design_layout_tab_text.xml)
(new resource id design_menu_item_action_area from C:\Users\Amit\Desktop\Vehicles_Unity\Anwar\10-april\Vehicles10Apr2018\Vehicles\Temp\StagingArea\android-libraries\com.android.support.design-internal-28.0.0-alpha1\res\layout\design_menu_item_action_area.xml)
]
exit code: 1
at UnityEditor.Android.Command.WaitForProgramToRun (UnityEditor.Utils.Program p, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) [0x00000] in <filename unknown>:0
at UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) [0x00000] in <filename unknown>:0
at UnityEditor.Android.PostProcessor.Tasks.TasksCommon.Exec (System.String command, System.String args, System.String workingdir, System.String errorMsg) [0x00000] in <filename unknown>:0
at UnityEditor.Android.PostProcessor.Tasks.BuildResources.CompileResources (UnityEditor.Android.PostProcessor.PostProcessorContext context) [0x00000] in <filename unknown>:0
at UnityEditor.Android.PostProcessor.Tasks.BuildResources.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context) [0x00000] in <filename unknown>:0
at UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) [0x00000] in <filename unknown>:0
UnityEditor.BuildPipeline:BuildPlayerInternalNoCheck(String[], String, String, BuildTargetGroup, BuildTarget, BuildOptions, Boolean)
UnityEditor.DefaultBuildMethods:BuildPlayer(BuildPlayerOptions) (at C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindowBuildMethods.cs:165)
UnityEditor.BuildPlayerWindow:CallBuildMethods(Boolean, BuildOptions) (at C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindowBuildMethods.cs:89)
UnityEditor.BuildPlayerWindow:GUIBuildButtons(IBuildWindowExtension, Boolean, Boolean, Boolean, BuildPlatform) (at C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindow.cs:885)
UnityEditor.BuildPlayerWindow:ShowBuildTargetSettings() (at C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindow.cs:810)
UnityEditor.BuildPlayerWindow:OnGUI() (at C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindow.cs:415)
System.Reflection.MonoMethod:InternalInvoke(Object, Object[], Exception&)

Adding drawables to an ImageView

I am having an issue with Mono for Android and adding drawables as background images or image resources in an ImageView. I have a file in my drawable folder called LogoLarge.png, which I want to display. Its Build Action is set to AndroidResource. So I try this:
<ImageView
android:id="#+id/Logo"
android:src="#drawable/LogoLarge"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
/>
The LogoLarge resource is referenced in Resource.Designer.cs. Building the project works fine. When I try to deploy to the emulator, I get the following in the build output:
C:\Program Files (x86)\MSBuild\Novell\mandroid.exe -v --nosign --sdk-dir="C:\Android" --builddir="C:\Users\Vegard\Documents\Visual Studio 2010\Projects\HelloAndroid\HelloWorld2\obj\Debug\android" --framework-dir="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v2.2" --framework-dir="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0" -S="C:\Users\Vegard\Documents\Visual Studio 2010\Projects\HelloAndroid\HelloWorld2\obj\Debug\res" --package="HelloWorld2.HelloWorld2" --nolink --abi="armeabi" --java-sdk-dir="C:\Program Files\Java\jdk1.6.0_26" --debug --manifest-template="C:\Users\Vegard\Documents\Visual Studio 2010\Projects\HelloAndroid\HelloWorld2\Properties\AndroidManifest.xml" --sdk-platform="8" "C:\Users\Vegard\Documents\Visual Studio 2010\Projects\HelloAndroid\HelloWorld2\bin\Debug\HelloWorld2.dll" "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v2.2\Mono.Android.dll" "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\mscorlib.dll" "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\System.Core.dll" "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\System.dll" "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\System.Xml.dll" "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\System.Xml.Linq.dll"
monodroid : error 1: System.NullReferenceException: Object reference not set to an instance of an object [C:\Users\Vegard\Documents\Visual Studio 2010\Projects\HelloAndroid\HelloWorld2\HelloWorld2.csproj]
at MonoDroid.Utils.ProcessRocks+<ReadStandardOutput>c__Iterator5.MoveNext () [0x00000] in <filename unknown>:0
at Monodroid.Toolbox.InvokeCommand (IEnumerable`1 commandLine) [0x00000] in <filename unknown>:0
at Monodroid.Toolbox.InvokeAapt (System.String packageName) [0x00000] in <filename unknown>:0
at Monodroid.Droidinator.CreatePackagedResources (System.Collections.Generic.List`1 javaTypes) [0x00000] in <filename unknown>:0
at Monodroid.Droidinator.CreateApk () [0x00000] in <filename unknown>:0
at Monodroid.MainClass.Main (System.String[] argv) [0x00000] in <filename unknown>:0
Done Building Project "C:\Users\Vegard\Documents\Visual Studio 2010\Projects\HelloAndroid\HelloWorld2\HelloWorld2.csproj" (SignAndroidPackage target(s)) -- FAILED.
If I remove the android:src property from the XML file, and put this in my Activity1.cs file, it works:
ImageView i = FindViewById<ImageView>(Resource.Id.Logo);
i.SetImageResource(Resource.Drawable.LogoLarge);
The same issue also occurs when trying to set a background image for any view using android:background="#drawable/SomeBackground" in XML, but works fine when doing it programmatically.
What is happening here. Is this a bug in MonoDroid?
I think that your LogoLarge must be logolarge , because you only can use lower case letters in the drawables.

Monodroid will not deploy when using an ImageView

I have this in my Main.axml;
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="fill_parent"
android:layout_width="fill_parent"
>
<Button
android:id="#+id/MyButton"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:text="#string/Hello"/>
<ImageView
android:src="#drawable/samplebackground"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/MyButton"/>
</RelativeLayout>
It builds fine and sampleBackground is a jpg that has been included in my project.
However when I try to deploy I get an error;
Object reference not set to an instance of an object
And there are a bunch of lines stating <filename unknown>
If I remove the ImageView from the markup the application deploys fine.
Any thoughts?
full stack
------ Build started: Project: MonoAndroidApplication1, Configuration: Debug Any CPU ------
MonoAndroidApplication1 -> C:\Development\MonoAndroidApplication1\MonoAndroidApplication1\bin\Debug\MonoAndroidApplication1.dll
Microsoft (R) Build Engine Version 4.0.30319.1
[Microsoft .NET Framework, Version 4.0.30319.225]
Copyright (C) Microsoft Corporation 2007. All rights reserved.
Build started 8/06/2011 8:37:40 AM.
Project "C:\Development\MonoAndroidApplication1\MonoAndroidApplication1\MonoAndroidApplication1.csproj" on node 1 (SignAndroidPackage target(s)).
_GenerateAndroidAssetsDir:
Skipping target "_GenerateAndroidAssetsDir" because it has no outputs.
_ResolveMonoAndroidSdks:
Looking for Android SDK..
Key HKCU\SOFTWARE\Android SDK Tools\Path not found.
Key HKLM\SOFTWARE\Android SDK Tools\Path found:
Path contains adb.exe in \platform-tools (C:\Program Files\Android\android-sdk).
Looking for Java SDK..
Key HKLM\SOFTWARE\JavaSoft\Java Development Kit\CurrentVersion found: 1.6.
Key HKLM\SOFTWARE\JavaSoft\Java Development Kit\1.6\JavaHome found:
Path contains jarsigner.exe in \bin (C:\Program Files\Java\jdk1.6.0_25).
MonoAndroid Tools: C:\Program Files\MSBuild\Novell\
MonoAndroid Framework: C:\Program Files\Reference Assemblies\Microsoft\Framework\MonoAndroid\v2.2\;C:\Program Files\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\
Android SDK: C:\Program Files\Android\android-sdk\
Java SDK: C:\Program Files\Java\jdk1.6.0_25\
_ValidateAndroidPackageProperties:
GetAndroidPackageName Task
ManifestFile:
AssemblyName: MonoAndroidApplication1
PackageName: MonoAndroidApplication1.MonoAndroidApplication1
_UpdateAndroidResgen:
Skipping target "_UpdateAndroidResgen" because all output files are up-to-date with respect to the input files.
GenerateTargetFrameworkMonikerAttribute:
Skipping target "GenerateTargetFrameworkMonikerAttribute" because all output files are up-to-date with respect to the input files.
CoreCompile:
Skipping target "CoreCompile" because all output files are up-to-date with respect to the input files.
_CopyOutOfDateSourceItemsToOutputDirectoryAlways:
Copying file from "C:\Development\MonoAndroidApplication1\MonoAndroidApplication1\Resources\Drawable-land\Icon.png" to "bin\Debug\Resources\Drawable-land\Icon.png".
CopyFilesToOutputDirectory:
MonoAndroidApplication1 -> C:\Development\MonoAndroidApplication1\MonoAndroidApplication1\bin\Debug\MonoAndroidApplication1.dll
ContractDeclarativeAssemblyCS:
Skipping target "ContractDeclarativeAssemblyCS" because all output files are up-to-date with respect to the input files.
_ConvertDebuggingFiles:
Skipping target "_ConvertDebuggingFiles" because all output files are up-to-date with respect to the input files.
_CompileAndroidPackage:
Mandroid Task
Assemblies: C:\Development\MonoAndroidApplication1\MonoAndroidApplication1\bin\Debug\MonoAndroidApplication1.dll; C:\Program Files\Reference Assemblies\Microsoft\Framework\MonoAndroid\v2.2\Mono.Android.dll; C:\Program Files\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\mscorlib.dll; C:\Program Files\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\System.Core.dll; C:\Program Files\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\System.dll; C:\Program Files\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\System.Xml.dll; C:\Program Files\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\System.Xml.Linq.dll
I18nAssemblies:
BuildDirectory: C:\Development\MonoAndroidApplication1\MonoAndroidApplication1\obj\Debug\
ReferenceAssembliesDirectory: C:\Program Files\Reference Assemblies\Microsoft\Framework\MonoAndroid\v2.2\;C:\Program Files\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\;;
AndroidSdkDirectory: C:\Program Files\Android\android-sdk\
JavaSdkDirectory: C:\Program Files\Java\jdk1.6.0_25\
AssetDirectory: C:\Development\MonoAndroidApplication1\MonoAndroidApplication1\obj\Debug\assets\
AndroidSdkPlatform: 8
MonoAndroidToolsDirectory: C:\Program Files\MSBuild\Novell\
ResourceDirectory: C:\Development\MonoAndroidApplication1\MonoAndroidApplication1\obj\Debug\res\
ManifestTemplate:
Package: MonoAndroidApplication1.MonoAndroidApplication1
NativeLibrary:
JavaSource:
Debug: True
UseSharedRuntime: True
SupportedAbis: armeabi
LinkMode: None
ExtraArgs:
C:\Program Files\MSBuild\Novell\mandroid.exe -v --nosign --sdk-dir="C:\Program Files\Android\android-sdk" --builddir="C:\Development\MonoAndroidApplication1\MonoAndroidApplication1\obj\Debug\android" --framework-dir="C:\Program Files\Reference Assemblies\Microsoft\Framework\MonoAndroid\v2.2" --framework-dir="C:\Program Files\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0" -S="C:\Development\MonoAndroidApplication1\MonoAndroidApplication1\obj\Debug\res" --package="MonoAndroidApplication1.MonoAndroidApplication1" --nolink --abi="armeabi" --java-sdk-dir="C:\Program Files\Java\jdk1.6.0_25" --debug --sdk-platform="8" -A="C:\Development\MonoAndroidApplication1\MonoAndroidApplication1\obj\Debug\assets" "C:\Development\MonoAndroidApplication1\MonoAndroidApplication1\bin\Debug\MonoAndroidApplication1.dll" "C:\Program Files\Reference Assemblies\Microsoft\Framework\MonoAndroid\v2.2\Mono.Android.dll" "C:\Program Files\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\mscorlib.dll" "C:\Program Files\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\System.Core.dll" "C:\Program Files\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\System.dll" "C:\Program Files\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\System.Xml.dll" "C:\Program Files\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\System.Xml.Linq.dll"
monodroid : error 1: System.NullReferenceException: Object reference not set to an instance of an object [C:\Development\MonoAndroidApplication1\MonoAndroidApplication1\MonoAndroidApplication1.csproj]
at MonoDroid.Utils.ProcessRocks+c__Iterator5.MoveNext () [0x00000] in :0
at Monodroid.Toolbox.InvokeCommand (IEnumerable1 commandLine) [0x00000] in <filename unknown>:0
at Monodroid.Toolbox.InvokeAapt (System.String packageName) [0x00000] in <filename unknown>:0
at Monodroid.Droidinator.CreatePackagedResources (System.Collections.Generic.List1 javaTypes) [0x00000] in :0
at Monodroid.Droidinator.CreateApk () [0x00000] in :0
at Monodroid.MainClass.Main (System.String[] argv) [0x00000] in :0
Done Building Project "C:\Development\MonoAndroidApplication1\MonoAndroidApplication1\MonoAndroidApplication1.csproj" (SignAndroidPackage target(s)) -- FAILED.
Build FAILED.
"C:\Development\MonoAndroidApplication1\MonoAndroidApplication1\MonoAndroidApplication1.csproj" (SignAndroidPackage target) (1) ->
(_CompileAndroidPackage target) ->
monodroid : error 1: System.NullReferenceException: Object reference not set to an instance of an object [C:\Development\MonoAndroidApplication1\MonoAndroidApplication1\MonoAndroidApplication1.csproj]
EDIT:
I found the solution; just make sure the image filename is in lowercase.
My image was named Image.png by renaming it to image.png it worked.
It's easy enough to reproduce - just create a new solution with a layout with a ImageView. Set the android:src="#drawable/Image".
If I type the Image with lowercase, image, it gives a compiler error, but when i correct it to Image no compile time errors, but the packaging fails...
The Image is in the correct folder and set to AnddroidResource.
So I would indeed like some help on this one too.
Thanks, Nicklas
Make sure that the Build Action for that image file is set to AndroidResource. You can set the Build Action by right clicking on the file in Visual Studio and selecting Properties.

Categories

Resources