开发者

Monodroid null pointer when packaging

开发者 https://www.devze.com 2023-03-06 01:59 出处:网络
Latest version of MonoDroid on Windows 7 x64 / VS 2010 Pro. Simple examples work great, but on my \'real\' app I get a null pointer when packaging (either after trying to run the app, or selecting th

Latest version of MonoDroid on Windows 7 x64 / VS 2010 Pro.

Simple examples work great, but on my 'real' app I get a null pointer when packaging (either after trying to run the app, or selecting the 'package' options from the build menu.

The relevant output looks like this:

C:\Program Files (x86)\MSBuild\Novell\mandroid.exe -v --nosign --sdk-dir="C:\Program Files (x86)\Android\android-sdk-windows" --builddir="[LOCALPATH]Clients[NAMESPACE].Android\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="[LOCALPATH]Clients[NAMESPACE].Android\obj\Debug\res" --package="[NAMESPACE]" --nolink --noshared --abi="armeabi" --java-sdk-dir="C:\Program Files (x86)\Java\jdk1.6.0_24" --debug --manifest-template="[LOCALPATH]Clients[NAMESPACE].Android\Properties\AndroidManifest.xml" --sdk-platform="8" "[LOCALPATH]Clients[NAMESPACE].Android\bin\Debug[ASSEMBLY].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" "[LOCALPATH]Android\Core[NAMESPACE].Client.Android\bin\Debug[NAMESPACE].Client.Android.dll" "[LOCALPATH]Android\Core[NAMESPACE].Core.Android\bin\Debug[NAMESPACE].Core.Android.dll" "[LOCALPATH]Android[NAMESPACE].Diagnostics.Android\bin\Debug[NAMESPACE].Diagnostics.Android.dll" "[LOCALPATH]Android[NAMESPACE].Logging.Android\bin\Debug[NAMESPACE].Logging.Android.dll" "[LOCALPATH]Android\Core[NAMESPACE].Services.Android\bin\Debug[NAMESPACE].Services.Android.dll" "[LOCALPATH]Android\Shared[NAMESPACE].Utils.Android\bin\Debug[NAMESPACE].Utils.Android.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 [[LOCALPATH]Clients[NAMESPACE].Android[NAMESPACE].Android.csproj] at MonoDroid.Utils.ProcessRocks+c__Iterator5.MoveNext () [0x00000] in :0 at Monodroid.Toolbox.InvokeCommand (IEnume开发者_C百科rable1 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 "[LOCALPATH]Clients[NAMESPACE].Android[NAMESPACE].Android.csproj" (SignAndroidPackage target(s)) -- FAILED.

Build FAILED.

"[LOCALPATH]Clients[NAMESPACE].Android[NAMESPACE].Android.csproj" (SignAndroidPackage target) (1) -> (_CompileAndroidPackage target) -> monodroid : error 1: System.NullReferenceException: Object reference not set to an instance of an object [[LOCALPATH]Clients[NAMESPACE].Android[NAMESPACE].Android.csproj]

Since a simple example works, it must be something in my project but I have no idea where to start looking... Does anyone have a hint?

Thanks in advance


Figured this out by creating a new Android app and progressively adding items to it until I hit the problem.

The issue was with my AndroidManifest.xml, which contained the following:

<supports-screens android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" />

Originally the app supported 2.3 and higher only, but at some point we rolled it back to 2.2. Whether this is what introduced the issue or not, I don't know. However the problem is resolved by removing:

android:largeScreens="true"

From that tag.

0

精彩评论

暂无评论...
验证码 换一张
取 消