I am trying to build Xamarin Forms Android App but it's not getting compiled in Release mode, while Debug works fine.
Error Detail:
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(5,5):
Error MSB4018: The "LinkAssemblies" task failed unexpectedly.
Mono.Linker.Steps.XmlResolutionException: Failed to process XML
description: --->
Mono.Cecil.AssemblyResolutionException: Failed to resolve assembly:
'Prism.Core, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'
---> Mono.Cecil.AssemblyResolutionException: Failed to resolve assembly: 'Prism.Core, Version=0.0.0.0, Culture=neutral,
PublicKeyToken=null' at Mono.Cecil.BaseAssemblyResolver.Resolve
(Mono.Cecil.AssemblyNameReference name, Mono.Cecil.ReaderParameters
parameters) [0x0015e] in
/Users/builder/data/lanes/6102/8255f42f/source/monodroid/external/xamarin-android/external/mono/external/cecil/Mono.Cecil/BaseAssemblyResolver.cs:172
at Mono.Linker.AssemblyResolver.Resolve
(Mono.Cecil.AssemblyNameReference name, Mono.Cecil.ReaderParameters
parameters) [0x0005c] in <947dd92f52fa43c1922f96c7b9774bdc>:0 at
Mono.Linker.LinkContext.Resolve (Mono.Cecil.IMetadataScope scope)
[0x00007] in <947dd92f52fa43c1922f96c7b9774bdc>:0 --- End of inner
exception stack trace --- at Mono.Linker.LinkContext.Resolve
(Mono.Cecil.IMetadataScope scope) [0x00030] in
<947dd92f52fa43c1922f96c7b9774bdc>:0 at
Mono.Linker.Steps.ResolveFromXmlStep.GetAssembly
(Mono.Linker.LinkContext context, Mono.Cecil.AssemblyNameReference
assemblyName) [0x00000] in <947dd92f52fa43c1922f96c7b9774bdc>:0 at
Mono.Linker.Steps.ResolveFromXmlStep.ProcessAssemblies
(Mono.Linker.LinkContext context, System.Xml.XPath.XPathNodeIterator
iterator) [0x00010] in <947dd92f52fa43c1922f96c7b9774bdc>:0 at
Mono.Linker.Steps.ResolveFromXmlStep.Process () [0x00037] in
<947dd92f52fa43c1922f96c7b9774bdc>:0 --- End of inner exception
stack trace --- at Mono.Linker.Steps.ResolveFromXmlStep.Process ()
[0x000a9] in <947dd92f52fa43c1922f96c7b9774bdc>:0 at
Mono.Linker.Steps.BaseStep.Process (Mono.Linker.LinkContext context)
[0x00010] in <947dd92f52fa43c1922f96c7b9774bdc>:0 at
Mono.Linker.Pipeline.Process (Mono.Linker.LinkContext context)
[0x0001c] in <947dd92f52fa43c1922f96c7b9774bdc>:0 at
MonoDroid.Tuner.Linker.Run (Mono.Linker.Pipeline pipeline,
Mono.Linker.LinkContext context) [0x00000] in
<947dd92f52fa43c1922f96c7b9774bdc>:0 at
MonoDroid.Tuner.Linker.Process (MonoDroid.Tuner.LinkerOptions options,
Mono.Linker.ILogger logger, Mono.Linker.LinkContext& context)
[0x00071] in <947dd92f52fa43c1922f96c7b9774bdc>:0 at
Xamarin.Android.Tasks.LinkAssemblies.Execute
(Java.Interop.Tools.Cecil.DirectoryAssemblyResolver res) [0x002d4] in
<947dd92f52fa43c1922f96c7b9774bdc>:0 at
Xamarin.Android.Tasks.LinkAssemblies.Execute () [0x0021f] in
<947dd92f52fa43c1922f96c7b9774bdc>:0 at
Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute
() [0x00023] in
/Users/builder/jenkins/workspace/build-package-osx-mono/2018-06/external/bockbuild/builds/msbuild-15/src/Build/BackEnd/TaskExecutionHost/TaskExecutionHost.cs:573
at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask
(Microsoft.Build.BackEnd.ITaskExecutionHost taskExecutionHost,
Microsoft.Build.BackEnd.Logging.TaskLoggingContext taskLoggingContext,
Microsoft.Build.BackEnd.TaskHost taskHost,
Microsoft.Build.BackEnd.ItemBucket bucket,
Microsoft.Build.BackEnd.TaskExecutionMode howToExecuteTask) [0x001f6]
in
/Users/builder/jenkins/workspace/build-package-osx-mono/2018-06/external/bockbuild/builds/msbuild-15/src/Build/BackEnd/Components/RequestBuilder/TaskBuilder.cs:784
(MSB4018) (VSTSBuild.Droid)
Also I noticed that it's building in Release mode as well if I enable 'Use Shared Mono Runtime' but if it's disabled then I am having issue building the solution.
Okay, I found out that issue was with LinkerSettings. Previously my Linker Settings was like this:
<linker>
<assembly
fullname="Prism.Core" />
<assembly
fullname="Prism.Forms" />
<assembly
fullname="Prism.Unity.Forms" />
<assembly
fullname="Prism.Plugin.Popups" />
</linker>
Which I updated to:
<linker>
<assembly
fullname="Prism.Forms">
<type
fullname="Prism.Common.ApplicationProvider"
preserve="all" />
<type
fullname="Prism.Services.PageDialogService"
preserve="all" />
<type
fullname="Prism.Services.DeviceService"
preserve="all" />
<type
fullname="Prism.Ioc*"
preserve="all" />
<type
fullname="Prism.Modularity*"
preserve="all" />
<type
fullname="Prism.Navigation*"
preserve="all" />
<type
fullname="Prism.Behaviors.PageBehaviorFactory"
preserve="all">
<method
name=".ctor" />
</type>
<type
fullname="Prism.Services.DependencyService"
preserve="all">
<method
name=".ctor" />
</type>
</assembly>
<assembly
fullname="Prism">
<type
fullname="Prism.Navigation*"
preserve="all" />
<type
fullname="Prism.Logging.EmptyLogger"
preserve="all">
<method
name=".ctor" />
</type>
</assembly>
</linker>
Now App is building fine in Release mode as well.
Related
This is my situation:
in my MSCRM 2016 On-Prem Version I have 3 Types of Solutions for the same, I will call it, Base-Solution.
These are:
IWO_CRM (V2.3.0.0) -> Base-Solution
IWO_CRM_Patch_... (V2.3.1.0) -> Contains a Workflow that was quickly needed
IWO_CRM_Upgrade (V2.4.0.2) -> Newly imported Base-Solution for Upgrade
These are all Managed Solutions.
Normally I would just Upgrade and would get a beautiful IWO_CRM (V2.4.0.2)
But Murphy faceslapped me and denied!
My Problem now is:
I can't run the Upgrade because it can't find all entitys contained in the Base-Solution.
The error log states, that the Workflow from the Patch-Solution is missing.
But I can't merge the Base-Solution with the Patch-Solution without using the Upgrade-Solution.
I can't uninstall the Patch or Upgrade Solution, when I try i get the Error that an Entity could not be found.
And while everything is in this mess, I'm unsure of what should I do or could I do.
Here an overview of the different Errors:
Try to Upgrade the Solution
Unhandled Exception: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=8.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]: workflow With Id = db73b25c-c714-46d0-9d05-d3d19a33e82a Does Not ExistDetail:
<OrganizationServiceFault xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/xrm/2011/Contracts">
<ActivityId>3d3042f4-a52b-47d4-a93f-871e1904526e</ActivityId>
<ErrorCode>-2147220969</ErrorCode>
<ErrorDetails xmlns:d2p1="http://schemas.datacontract.org/2004/07/System.Collections.Generic" />
<Message>workflow With Id = db73b25c-c714-46d0-9d05-d3d19a33e82a Does Not Exist</Message>
<Timestamp>2019-09-05T08:24:15.968578Z</Timestamp>
<ExceptionRetriable>false</ExceptionRetriable>
<ExceptionSource i:nil="true" />
<InnerFault i:nil="true" />
<OriginalException i:nil="true" />
<TraceText i:nil="true" />
</OrganizationServiceFault>
Try to delete the Upgrade-Solution
Unhandled Exception: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=8.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]: All entities must be found.Detail:
<OrganizationServiceFault xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/xrm/2011/Contracts">
<ActivityId>ef3e6030-5d3f-43b7-a202-c82584b7f15a</ActivityId>
<ErrorCode>-2147220970</ErrorCode>
<ErrorDetails xmlns:d2p1="http://schemas.datacontract.org/2004/07/System.Collections.Generic" />
<Message>All entities must be found.</Message>
<Timestamp>2019-09-05T08:48:57.9558391Z</Timestamp>
<ExceptionRetriable>false</ExceptionRetriable>
<ExceptionSource i:nil="true" />
<InnerFault i:nil="true" />
<OriginalException i:nil="true" />
<TraceText i:nil="true" />
</OrganizationServiceFault>
Try to delete the Patch-Solution (Looks truly like the first Error)
Unhandled Exception: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=8.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]: workflow With Id = db73b25c-c714-46d0-9d05-d3d19a33e82a Does Not ExistDetail:
<OrganizationServiceFault xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/xrm/2011/Contracts">
<ActivityId>7b9f6465-df4d-44af-8497-c706bd9fee5b</ActivityId>
<ErrorCode>-2147220969</ErrorCode>
<ErrorDetails xmlns:d2p1="http://schemas.datacontract.org/2004/07/System.Collections.Generic" />
<Message>workflow With Id = db73b25c-c714-46d0-9d05-d3d19a33e82a Does Not Exist</Message>
<Timestamp>2019-09-05T08:50:25.7216539Z</Timestamp>
<ExceptionRetriable>false</ExceptionRetriable>
<ExceptionSource i:nil="true" />
<InnerFault i:nil="true" />
<OriginalException i:nil="true" />
<TraceText i:nil="true" />
</OrganizationServiceFault>
I realy hope that this is enough information to picture my problem.
Any help is appreciated.
Thank's everyone
I used this demo to use background location services for my Android project (since Geolocator wouldn't background on Android). I haven't had any problems until yesterday when it gave me the following error:
[ServiceConnection] OnServiceConnected Called
Service Connected
[LocationService] You are about to get location updates via
[Mono] Assembly Ref addref Mono.Security[0xa7dd6ba0] -> System[0xadd5aac0]: 15
[Mono] DllImport attempting to load: '/system/lib/liblog.so'.
[Mono] DllImport loaded library '/system/lib/liblog.so'.
[Mono] DllImport searching in: '/system/lib/liblog.so' ('/system/lib/liblog.so').
[Mono] Searching for '__android_log_print'.
[Mono] Probing '__android_log_print'.
[Mono] Found as '__android_log_print'.
[MonoDroid] UNHANDLED EXCEPTION:
[MonoDroid] Java.Lang.IllegalArgumentException: invalid provider: null
[MonoDroid] at Java.Interop.JniEnvironment+InstanceMethods.CallVoidMethod (Java.Interop.JniObjectReference instance, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue* args) [0x00069] in <ab9e0fea7db841c1a1450c120052eb14>:0
[MonoDroid] at Java.Interop.JniPeerMembers+JniInstanceMethods.InvokeVirtualVoidMethod (System.String encodedMember, Java.Interop.IJavaPeerable self, Java.Interop.JniArgumentValue* parameters) [0x0002a] in <ab9e0fea7db841c1a1450c120052eb14>:0
[MonoDroid] at Android.Locations.LocationManager.RequestLocationUpdates (System.String provider, System.Int64 minTime, System.Single minDistance, Android.Locations.ILocationListener listener) [0x0007e] in <21f1b0b5ad7242d7afaeceae3e6dbac8>:0
[MonoDroid] at Divco.LocationService.StartLocationUpdates () [0x0003c] in /Users/ediewoelfle/Developer/ancient-bastion-mobile/Droid/Services/LocationService.cs:78
[MonoDroid] at Divco.LocationServiceConnection.OnServiceConnected (Android.Content.ComponentName name, Android.OS.IBinder service) [0x0004f] in /Users/ediewoelfle/Developer/ancient-bastion-mobile/Droid/Services/LocationServiceConnection.cs:42
[MonoDroid] at Android.Content.IServiceConnectionInvoker.n_OnServiceConnected_Landroid_content_ComponentName_Landroid_os_IBinder_ (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_name, System.IntPtr native_service) [0x00019] in <21f1b0b5ad7242d7afaeceae3e6dbac8>:0
[MonoDroid] at (wrapper dynamic-method) System.Object.31(intptr,intptr,intptr,intptr)
[MonoDroid] --- End of managed Java.Lang.IllegalArgumentException stack trace ---
[MonoDroid] java.lang.IllegalArgumentException: invalid provider: null
[MonoDroid] at android.location.LocationManager.checkProvider(LocationManager.java:2317)
[MonoDroid] at android.location.LocationManager.requestLocationUpdates(LocationManager.java:490)
[MonoDroid] at md587a0a65fe57ffee4ef3988209babfc12.LocationServiceConnection.n_onServiceConnected(Native Method)
[MonoDroid] at md587a0a65fe57ffee4ef3988209babfc12.LocationServiceConnection.onServiceConnected(LocationServiceConnection.java:38)
[MonoDroid] at android.app.LoadedApk$ServiceDispatcher.doConnected(LoadedApk.java:1535)
[MonoDroid] at android.app.LoadedApk$ServiceDispatcher$RunConnection.run(LoadedApk.java:1563)
[MonoDroid] at android.os.Handler.handleCallback(Handler.java:751)
[MonoDroid] at android.os.Handler.dispatchMessage(Handler.java:95)
[MonoDroid] at android.os.Looper.loop(Looper.java:154)
[MonoDroid] at android.app.ActivityThread.main(ActivityThread.java:6316)
[MonoDroid] at java.lang.reflect.Method.invoke(Native Method)
[MonoDroid] at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:872)
[MonoDroid] at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:762)
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="42" android:versionName="0.1" package="com.divcodelivery.divco">
<uses-sdk android:minSdkVersion="23" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.SEND_SMS" />
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
<uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_SURFACE_FLINGER" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<application android:label="Divco" android:icon="#drawable/logo_size_icon">
<provider android:name="android.support.v4.content.FileProvider" android:authorities="com.divcodelivery.divco.fileprovider" android:exported="false" android:grantUriPermissions="true">
<meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="#xml/file_paths"></meta-data>
</provider>
</application>
</manifest>
I have located the null locationProvider, however, I am unsure WHY.
I want each Entry type in my in my StackLayout to have a margin. I'm trying to specify a style as follows:
<StackLayout IsVisible="{Binding IsLoggingIn, Converter={StaticResource BooleanConverter}}">
<StackLayout.Resources>
<Style TargetType="{x:Type Entry}">
<Setter Property="Margin" Value="0,0,0,20"/>
</Style>
</StackLayout.Resources>
<Entry ... />
<Entry ... />
</StackLayout>
Unfortunately, it results in a NullReferenceException:
04-13 16:26:15.406 E/mono (17167): Unhandled Exception:
04-13 16:26:15.406 E/mono (17167): System.NullReferenceException: Object reference not set to an instance of an object.
04-13 16:26:15.406 E/mono-rt (17167): [ERROR] FATAL UNHANDLED EXCEPTION: System.NullReferenceException: Object reference not set to an instance of an object.
With a bit more stack trace for reference:
Unhandled Exception:
System.NullReferenceException: Object reference not set to an instance of an object.
at MyApp.Views.Login.InitializeComponent () [0x00012] in C:\dev\PathTo\MyApp\obj\Debug\MyApp.Views.Login.xaml.g.cs:22
at MyApp.Views.Login..ctor () [0x00008] in C:\dev\PathTo\MyApp\Views\Login.xaml.cs:9
at MyApp.App.SetupLoginPage () [0x00001] in C:\dev\PathTo\MyApp\App.xaml.cs:94
at MyApp.App+<OnStart>d__4.MoveNext () [0x001ad] in C:\dev\PathTo\MyApp\App.xaml.cs:60
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Users/builder/data/lanes/4009/3a62f1ea/source/mono/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:143
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.<ThrowAsync>m__0 (System.Object state) [0x00000] in /Users/builder/data/lanes/4009/3a62f1ea/source/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:1018
at Android.App.SyncContext+<Post>c__AnonStorey0.<>m__0 () [0x00000] in /Users/builder/data/lanes/4009/3a62f1ea/source/xamarin-android/src/Mono.Android/Android.App/SyncContext.cs:35
at Java.Lang.Thread+RunnableImplementor.Run () [0x0000b] in /Users/builder/data/lanes/4009/3a62f1ea/source/xamarin-android/src/Mono.Android/Java.Lang/Thread.cs:36
at Java.Lang.IRunnableInvoker.n_Run (System.IntPtr jnienv, System.IntPtr native__this) [0x00009] in /Users/builder/data/lanes/4009/3a62f1ea/source/monodroid/src/Mono.Android/platforms/android-23/src/generated/Java.Lang.IRunnable.cs:81
at (wrapper dynamic-method) System.Object:d83972de-0492-4d07-a14d-24725ac1bfd1 (intptr,intptr)
What could be causing this, and how can I fix it? For the record, if I specify the margin inline e.g. <Entry margin="0,0,0,20"/>, it works fine.
I think your syntax is wrong. Shouldn't it be this;
<StackLayout.Resources>
<ResourceDictionary>
<Style TargetType="Entry">
<Setter Property="Margin" Value="0,0,0,20"/>
</Style>
</ResourceDictionary>
</StackLayout.Resources>
Note how I changed the TargetType and added the ResourceDictionary tag around it.
I'm trying to create a pop up window that shows a clock (actually what i want is a countdown timer but one thing at a time!), the trouble is when i call the method to show the pop up window containing the clock, the app crashes.
The method is being called from an Activity not a fragment.
Here is the code:
public void clockPopup()
{
LayoutInflater inflater =(LayoutInflater)this.GetSystemService(Context.LayoutInflaterService);
View myPopup = inflater.Inflate (Resource.Layout.PopUpClockTimer, null);
RunOnUiThread (() => {
PopupWindow popup = new PopupWindow (myPopup);
});
}
The stack trace is as follows:
[mono] Unhandled Exception:
[mono] Android.Views.InflateException: Exception of type 'Android.Views.InflateException' was thrown.
[mono] at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x00000] in <filename unknown>:0
[mono] at Android.Runtime.JNIEnv.CallObjectMethod (IntPtr jobject, IntPtr jmethod, Android.Runtime.JValue[] parms) [0x00000] in <filename unknown>:0
[mono] at Android.Views.LayoutInflater.Inflate (Int32 resource, Android.Views.ViewGroup root) [0x00000] in <filename unknown>:0
[mono] at FrogPoint.Droid.MainActivity.clockPopup () [0x00020] in /Users/jakememery/Desktop/working Frogpoint/FrogPoint1.2_database/FindTheMonkey.Droid/MainActivity.cs:1548
[mono] at FrogPoint.Droid.MainActivity+<getBeaconData>c__async3.MoveNext () [0x00258] in /Users/jakememery/Desktop/working Frogpoint/FrogPoint1.2_database/FindTheMonkey.Droid/MainActivity.cs:1215
[mono] --- End of stack trace from previous location where exception was thrown ---
[mono] at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x00000] in <filename unknown>:0
[mono] at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in <filename unknown>:0
[mono] at FrogPoint.Droid.MainActivity+<RangingBeaconsInRegion>c__async0.MoveNext () [0x0035d] in /Users/jakememery/Desktop/working Frogpoint/FrogPoint1.2_database/FindTheMonkey.Droid/MainActivity.cs:675
[mono] --- End of managed exception stack trace ---
[mono] android.view.InflateException: Binary XML file line #1: Error inflating class android.widget.AnalogClock
[mono] at android.view.LayoutInflater.createView(LayoutInflater.java:620)
[mono] at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
[mono] at android.view.LayoutInflater.onCreateView(LayoutInflater.java:669)
[mono] at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:694)
[mono] at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
[mono] at android.view.LayoutInflater.rInflate(LayoutInflater.java:758)
[mono] at android.view.LayoutInflater.rInflate(LayoutInflater.java:758)
[mono] at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
[mono] at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
[mono] at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
[mono] at dalvik.system.NativeStart.run(Native Method)
[mono] Caused by: java.lang.reflect.InvocationTargetException
[mono] at java.lang.reflect.Constructor.constructNative(Native Method)
[mono] at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
[mono] at android.view.LayoutInflater.createView(LayoutInflater.java:594)
[mono] ... 10 more
[mono] Caused by: java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()
[mono] at android.os.Handler.<init>(Handler.java:200)
[mono] at android.os.Handler.<init>(Handler.java:114)
[mono] at android.widget.AnalogClock.<init>(AnalogClock.java:57)
[mono] at android.widget.AnalogClock.<init>(AnalogClock.java:67)
Here is the XML i'm trying to inflate:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/customborder"
android:orientation="vertical">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="1dp"
android:orientation="vertical">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="20dp"
android:orientation="vertical">
<TextView
android:id="#+id/textout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Time sensitive offer" />
<ImageView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:src="#drawable/logo76" />
<AnalogClock
android:id="#+id/tabAnalogClock"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<DigitalClock
android:id="#+id/tabDigitalClock"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<Button
android:id="#+id/dismiss"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Dismiss" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
Can anybody see where i'm going wrong here please?
It seems i simply needed to call the method like this:
RunOnUiThread (() => {
clockPopup();
});
It doesn't crash now. But unfortunately neither does it display the pop up. But that's for another post.
You are missing either:
popup.ShowAtLocation(...);
or
popup.ShowAsDropDown(...);
to actually display the popup window.
I have the following wix include VersionFile.wxi
<?xml version="1.0" encoding="utf-8"?>
<Include>
<?define ProductVersionMajor = "1" ?>
<?define ProductVersionMinor = "00" ?>
<?define ProductName= "MyProduct" ?>
<?define UpgradeCode = "myUpgradeCode" ?>
</Include>
Now I want to get e.g. the ProductVersionMajor as "1" or ProductName "MyProduct" (without quotes) using XmlPeek and a XPath query. With following code
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Target Name="Test">
<XmlPeek XmlInputPath="VersionFile.wxi"
Query="//processing-instruction('define')[starts-with(., "ProductVersionMajor =")]">
<Output TaskParameter="Result" ItemName="Peeked" />
</XmlPeek>
<XmlPeek XmlInputPath="VersionFile.wxi"
Query="//processing-instruction('define')[starts-with(., "ProductVersionMajor=")]">
<Output TaskParameter="Result" ItemName="Peeked" />
</XmlPeek>
<Message Text="#(Peeked)"/>
</Target>
</Project>
I already got it down to
<?define ProductVersionMajor = "1" ?>
But goal would be
1
Any help how to tweak the XPath query highly appreciated. Also it'll be great to have a placeholder "ProductVersionMajor*=" instead using XmlPeek twice.
<XmlPeek XmlInputPath="ProductVersion.wxi"
Query="substring-before(substring-after(//processing-instruction("define")[starts-with(., "ProductVersionMajor=")],"),")">
<Output TaskParameter="Result" ItemName="Peeked" />
</XmlPeek>
unfortunately only produces an
error MSB3734: XPath Query "substring-before(substring-after(//processing-instruction("define")[starts-with(., "ProductVersionMajor=")],"),")" cannot be loaded. 'substring-before(substring-after(//processing-instruction("define")[starts-with(., "ProductVersionMajor=")],"),")' has an invalid token.
Assume that XmlPeek needs some more custom XPath syntax possibly?
Yes. Tried it as well. Now also tried
Query="substring-before(substring-after(//processing-instruction('define')[starts-with(., 'ProductVersionMajor =')],'"'),'"') ">
Also no success. Error is
error MSB4018: The "XmlPeek" task failed unexpectedly.\r
error MSB4018: System.Xml.XPath.XPathException: Expression must evaluate to a node-set.\r
error MSB4018: at System.Xml.XPath.XPathNavigator.Select(XPathExpression expr)\r
error MSB4018: at Microsoft.Build.Tasks.XmlPeek.Execute()\r
error MSB4018: at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()\r
error MSB4018: at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, Task
LoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask, Boolean& taskResult)
Form the xpath point of view the following should do:
Query='substring-before(
substring-after(
//processing-instruction("define")[starts-with(., "ProductVersionMajor =")]
,
'"'
)
,
'"'
)'
I solved this problem with this approach. Hope it helps:
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<UsingTask TaskName="GetWixDefine"
TaskFactory="CodeTaskFactory"
AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
<ParameterGroup>
<File ParameterType="System.String" Required="true" Output="false" />
<DefineName ParameterType="System.String" Required="true" Output="false" />
<Value ParameterType="System.String" Output="true" />
</ParameterGroup>
<Task>
<Reference Include="System.Xml" />
<Using Namespace="System" />
<Using Namespace="System.Text.RegularExpressions" />
<Using Namespace="System.Xml" />
<Code Type="Fragment" Language="cs">
<![CDATA[
this.Value = string.Empty;
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(this.File);
string selector = string.Format("//processing-instruction('define')[starts-with(., '{0}')]", this.DefineName);
XmlNode defineNode = xmlDoc.SelectSingleNode(selector);
if (defineNode == null)
throw new Exception("define not found");
string regex = string.Format("{0}[ ]*=[ ]*\"(?<value>.*)\"", DefineName);
Match match = Regex.Match(defineNode.InnerText, regex);
if (!match.Success)
throw new Exception("cannot match correctly");
this.Value = match.Groups["value"].Value;
]]>
</Code>
</Task>
</UsingTask>
<Target Name="BeforeBuild">
<GetWixDefine File="VersionFile.wxi" DefineName="ProductVersion">
<Output TaskParameter="Value" ItemName="ProductVersionValue"/>
</GetWixDefine>
<Message Importance="High" Text="ProductVersion: #(ProductVersionValue)"/>
</Target>
</Project>