Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all 204402 articles
Browse latest View live

Error MSB4018: The "IBTool" task failed unexpectedly. - After switching provisioning

$
0
0

Dear all,

Ive been struggling with this Issue for a couple of days now.

My Xamarin project was building fine and I was able to build both debug and release versions of the iOS project. I then had to change certificates and provisioning for upload to App Store connect.

Suddenly I start getting the MSB4018 (both debug and release versions). - Error below.

I have tried everything - reinstalling Xcode, cleaning / deep cleaning etc. This error keeps coming back.

Any ideas where I might start looking? (all info I could get from google was related to Xcode and installing components etc etc. -Have tried it all).

These are my vs details:
"=== Visual Studio Community 2019 for Mac ===

Version 8.6.4 (build 14)
Installation UUID: fc3a18e7-c7a3-4cb4-ae50-8fd4d1a74c46
GTK+ 2.24.23 (Raleigh theme)
Xamarin.Mac 6.18.0.23 (d16-6 / 088c73638)

Package version: 610000104

=== Mono Framework MDK ===

Runtime:
Mono 6.10.0.104 (2019-12/5d03a6fe116) (64-bit)
Package version: 610000104

=== Roslyn (Language Service) ===

3.6.0-3.20210.9+4eafdcb1bcbd8d3573f2ba6065e56d9b9ce4f8a3

=== NuGet ===

Version: 5.6.0.6591

=== .NET Core SDK ===

SDK: /usr/local/share/dotnet/sdk/3.1.301/Sdks
SDK Versions:
3.1.301
3.1.300
3.1.202
3.1.200
3.1.102
3.1.101
3.1.100
3.0.101
3.0.100
2.1.701
2.1.700
2.1.505
2.1.504
2.1.503
MSBuild SDKs: /Library/Frameworks/Mono.framework/Versions/6.10.0/lib/mono/msbuild/Current/bin/Sdks

=== .NET Core Runtime ===

Runtime: /usr/local/share/dotnet/dotnet
Runtime Versions:
3.1.5
3.1.4
3.1.2
3.1.1
3.1.0
3.0.1
3.0.0
2.1.19
2.1.18
2.1.17
2.1.16
2.1.15
2.1.14
2.1.13
2.1.12
2.1.11
2.1.9
2.1.8
2.1.7

=== Xamarin.Profiler ===

Version: 1.6.12.26
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

=== Updater ===

Version: 11

=== Xamarin.Android ===

Version: 10.3.1.4 (Visual Studio Community)
Commit: xamarin-android/d16-6/3a10de9
Android SDK: /Users/jenswoeste/Library/Developer/Xamarin/android-sdk-macosx
Supported Android versions:
6.0 (API level 23)
7.1 (API level 25)
8.0 (API level 26)
8.1 (API level 27)

SDK Tools Version: 26.1.1
SDK Platform Tools Version: 29.0.6
SDK Build Tools Version: 29.0.2

Build Information:
Mono: 165f4b0
Java.Interop: xamarin/java.interop/d16-6@2cab35c
ProGuard: xamarin/proguard/master@905836d
SQLite: xamarin/sqlite/3.31.1@49232bc
Xamarin.Android Tools: xamarin/xamarin-android-tools/d16-6@bfb66f3

=== Microsoft OpenJDK for Mobile ===

Java SDK: /Users/jenswoeste/Library/Developer/Xamarin/jdk/microsoft_dist_openjdk_8.0.25
1.8.0-25
Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

=== Android SDK Manager ===

Version: 16.6.0.50
Hash: 5901879
Branch: remotes/origin/d16-6
Build date: 2020-05-15 00:43:06 UTC

=== Android Device Manager ===

Version: 16.6.0.95
Hash: 45d17b5
Branch: remotes/origin/d16-6
Build date: 2020-05-15 00:43:26 UTC

=== Xamarin Designer ===

Version: 16.6.0.329
Hash: d4f8bcd13
Branch: remotes/origin/d16-6
Build date: 2020-04-24 02:16:02 UTC

=== Apple Developer Tools ===

Xcode 11.5 (16139)
Build 11E608c

=== Xamarin.Mac ===

Version: 6.18.2.1 (Visual Studio Community)
Hash: 29c4ea731
Branch: d16-6
Build date: 2020-05-26 17:03:04-0400

=== Xamarin.iOS ===

Version: 13.18.2.1 (Visual Studio Community)
Hash: 29c4ea731
Branch: d16-6
Build date: 2020-05-26 17:03:05-0400

=== Build Information ===

Release ID: 806040014
Git revision: b22fa17f4309e67d2f254d93f02d17613cf6ef6c
Build date: 2020-06-15 10:43:44-04
Build branch: release-8.6
Xamarin extensions: b22fa17f4309e67d2f254d93f02d17613cf6ef6c

=== Operating System ===

Mac OS X 10.15.5
Darwin 19.5.0 Darwin Kernel Version 19.5.0
Tue May 26 20:41:44 PDT 2020
root:xnu-6153.121.2~2/RELEASE_X86_64 x86_64

=== Enabled user installed extensions ===

DeepClean 1.2.5
Xamarin.Forms HotReload extension 1.4.0
Essential UI Kit for Xamarin.Forms - Syncfusion 2.5.0.0
Xamarin Extensions - Syncfusion 18.1.0.42
XAML Styler 2.0.1

"

'''
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/iOS/Xamarin.iOS.Common.targets(3,3): Error MSB4018: The "IBTool" task failed unexpectedly.
System.Xml.XmlException: The 'key' start tag on line 54 position 2 does not match the end tag of 'Key'. Line 54, position 21.
at System.Xml.XmlTextReaderImpl.Throw (System.Exception e) [0x00027] in /Users/builder/jenkins/workspace/build-package-osx-mono/2019-12/external/bockbuild/builds/mono-x64/mcs/class/referencesource/System.Xml/System/Xml/Core/XmlTextReaderImpl.cs:2503
at System.Xml.XmlTextReaderImpl.Throw (System.String res, System.String[] args) [0x00000] in /Users/builder/jenkins/workspace/build-package-osx-mono/2019-12/external/bockbuild/builds/mono-x64/mcs/class/referencesource/System.Xml/System/Xml/Core/XmlTextReaderImpl.cs:2486
at System.Xml.XmlTextReaderImpl.ThrowTagMismatch (System.Xml.XmlTextReaderImpl+NodeData startTag) [0x00086] in /Users/builder/jenkins/workspace/build-package-osx-mono/2019-12/external/bockbuild/builds/mono-x64/mcs/class/referencesource/System.Xml/System/Xml/Core/XmlTextReaderImpl.cs:4255
at System.Xml.XmlTextReaderImpl.ParseEndElement () [0x00085] in /Users/builder/jenkins/workspace/build-package-osx-mono/2019-12/external/bockbuild/builds/mono-x64/mcs/class/referencesource/System.Xml/System/Xml/Core/XmlTextReaderImpl.cs:4149
at System.Xml.XmlTextReaderImpl.ParseElementContent () [0x00149] in /Users/builder/jenkins/workspace/build-package-osx-mono/2019-12/external/bockbuild/builds/mono-x64/mcs/class/referencesource/System.Xml/System/Xml/Core/XmlTextReaderImpl.cs:3820
at System.Xml.XmlTextReaderImpl.Read () [0x00085] in /Users/builder/jenkins/workspace/build-package-osx-mono/2019-12/external/bockbuild/builds/mono-x64/mcs/class/referencesource/System.Xml/System/Xml/Core/XmlTextReaderImpl.cs:1166
at System.Xml.XmlReader.ReadString () [0x0006a] in /Users/builder/jenkins/workspace/build-package-osx-mono/2019-12/external/bockbuild/builds/mono-x64/mcs/class/referencesource/System.Xml/System/Xml/Core/XmlReader.cs:703
at System.Xml.XmlTextReaderImpl.ReadString () [0x00006] in /Users/builder/jenkins/workspace/build-package-osx-mono/2019-12/external/bockbuild/builds/mono-x64/mcs/class/referencesource/System.Xml/System/Xml/Core/XmlTextReaderImpl.cs:1506
at System.Xml.XmlReader.ReadElementString () [0x00043] in /Users/builder/jenkins/workspace/build-package-osx-mono/2019-12/external/bockbuild/builds/mono-x64/mcs/class/referencesource/System.Xml/System/Xml/Core/XmlReader.cs:778
at Xamarin.MacDev.PropertyListFormat+XmlFormat+Context.ReadDict (Xamarin.MacDev.PDictionary dict) [0x0005d] in :0
at Xamarin.MacDev.PropertyListFormat+ReadWriteContext.ReadObject () [0x0010c] in :0
at Xamarin.MacDev.PropertyListFormat+XmlFormat+Context.ReadArray (Xamarin.MacDev.PArray array) [0x000bf] in :0
at Xamarin.MacDev.PropertyListFormat+ReadWriteContext.ReadObject () [0x000f9] in :0
at Xamarin.MacDev.PropertyListFormat+XmlFormat+Context.ReadDict (Xamarin.MacDev.PDictionary dict) [0x000c9] in :0
at Xamarin.MacDev.PropertyListFormat+ReadWriteContext.ReadObject () [0x0010c] in :0
at Xamarin.MacDev.PObject.FromFile (System.String fileName, System.Boolean& isBinary) [0x00042] in :0
at Xamarin.MacDev.PDictionary.FromFile (System.String fileName, System.Boolean& isBinary) [0x00001] in :0
at Xamarin.MacDev.PDictionary.FromFile (System.String fileName) [0x00001] in :0
at Xamarin.MacDev.Tasks.IBToolTaskBase.Execute () [0x000b6] in :0
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute () [0x00023] in /Users/builder/jenkins/workspace/build-package-osx-mono/2019-12/external/bockbuild/builds/msbuild-15/src/Build/BackEnd/TaskExecutionHost/TaskExecutionHost.cs:575
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) [0x002a9] in /Users/builder/jenkins/workspace/build-package-osx-mono/2019-12/external/bockbuild/builds/msbuild-15/src/Build/BackEnd/Components/RequestBuilder/TaskBuilder.cs:818 (MSB4018) (Curo.iOS)
'''


Corner radius in relative layout

$
0
0

Hello, I am using a relative layout to display round buttons. I use the width property to make it responsive, but I don't get the corner radius responsive. It looks good on the iPhone 11 Pro, but on the iPhone SE is the radius too high. How can I make it reponsive? Here a screenshot of the iPhone 11 Pro and SE:

Here is my code:

        <RelativeLayout x:Name="mainLayout">

            <Button Text="Button" TextColor="White" CornerRadius="40" BackgroundColor="Gray" RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=0.2}" RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=0.2}"/>

    </RelativeLayout>

Is there any solution for this? Thanks in advance.

Can I use SQLite Database created in System.Data.SQLite with password in Xamarin.

$
0
0

Hi, I am new to mobile development, I used to develop Desktop in VS 2015, I installed VS 2019 recently, I want to do can use SQLite Database created in System.Data.SQLite with password in Xamarin Forms for mobile Development, and I want to use the existing SQLite Databases and how to attach them in Xamarin Forms Project.

Thanks.

Possible bug in xamarin implementation of location service?

$
0
0

Hi, I have been setting a mock location service with no problem. I have now tried to add vertical accuracy but I get the error:
Error while pushing mock locationno non-static method "Landroid/location/Location;.setVerticalAccuracyMeters(F)V

This is the normal code I use that worked fine until I added the part in bold:

Location mockLocation = new Location(LocationManager.GpsProvider);
mockLocation.Latitude = lat;
mockLocation.Longitude = lon;
mockLocation.Altitude = elev; //in meters
mockLocation.Speed = speed * 0.514444F; //from knots to meters/second
mockLocation.Bearing = bearing; //in degrees
mockLocation.Accuracy = accuracy; //in meters
mockLocation.Time = JavaSystem.CurrentTimeMillis();//timestamp;//
mockLocation.ElapsedRealtimeNanos = SystemClock.ElapsedRealtimeNanos();
mockLocation.VerticalAccuracyMeters = verticalaccuracy; (<-- this gives me an error, verticalaccuracy = 0.743 should be an acceptable float)
mockLocation.Extras = new Bundle();
foreach (string szKey in rgExtras.Keys)
mockLocation.Extras.PutString(szKey, rgExtras[szKey]);

I cannot find any information on that error when I tried to google it.

OrientationSensor.Start and FeatureNotSupportedException

$
0
0

Hi,
I am pretty new to Xamarin so this could be something basic, I've looked online and kind find no reference to this issue, so I am guessing it's me somewhere!

I am calling OrientationSensor as follows, and no matter how I attempt this I am getting a FeatureNotSupportedException exception. I have essentials installed and available to the project. So any idea what the problem could be?

try
{
if (OrientationSensor.IsMonitoring)
OrientationSensor.Stop();
else
OrientationSensor.Start(SensorSpeed.Fastest);
}
catch (FeatureNotSupportedException ex)
{
// Feature not supported on device
}
catch (Exception ex)
{
// Other error has occurred.
}

AWS S3 Object Permissions when saved a file using PutObject() in an Xamarin.Forms app

$
0
0

When I save to a file using PutObject(), the file becomes private. So subsequent reads are denied access. How do I make it public?

My code is:

                    PutObjectRequest request = new PutObjectRequest
                    {
                        BucketName = EntBucketName.Text.Trim(),
                        Key = FileName.Text.Trim(),
                        ContentBody = FileContents.Text.Trim(),
                        //CannedACL = S3CannedACL.PublicReadWrite,
                    };

                    PutObjectResponse response = await App.awsS3Client.PutObjectAsync(request);

When I set CannedACL property, the PutObject fails with 'Access Denied' exception. When that is not included the file is overwritten but becomes private so subsequent GetObject fails.

Deleting the file and then saving to it also didn't help.

Resource App Using Cosmos DB

$
0
0

Hello everyone. I am a brand new user of Xamarin, C#, and Azure (I know, it's probably a lot to learn at once but I'm determined). I have gotten to the point in my app development where I need to connect a database. I am creating an app for my local community where they can get on and search for local resources such as non-profits, public services, and health clinics and it'll show an address, phone number, how far they are from the user, etc.. I have created all of the items in Cosmos Db but now I have no idea how to connect it to my app. It's been a struggle trying to find tutorials that go step by step through the process and aren't super confusing. There will be no user profiles or anything of that nature. Any advice or links to tutorials that might explain connecting Cosmos Db to a simple resource app would be greatly appreciated. I apologize if this is a silly question! I've watched so many videos and read through several webpages of tutorials but most of them are for apps that let users edit the information in the database and I don't need that. I hope this all makes sense and I will gladly clarify if I need to! Thank you all so much!

  • Shannon Polk

MSB6006: "java.exe" exited with code 1

$
0
0

Hello Folks,

Whenever I am trying to deploy an android app I am getting a "java.exe" error. I tried to delete the bin & obj folder and also clean & rebuild the project. But still facing the same issue. Anyone has some other solution to resolve this problem. Please find the output file.


Frosted glass effect for a layout

$
0
0

How to achieve frosted glass effect for a layout (not just an image) in an xamarin-android app.

Any leads. I tried to search the web, but did not find much.

Thanks

How to use SQLite with more than one tables

$
0
0

Using the sample and code from the "Xamarin.Forms Local Databases" sample, unable to post link.

The example is using Data/TodoItemDatabase.cs as the connection and CRUD operations.

The method below creates the Table 'TodoItem' if it does not exists.

How do you use this file if you have other tables in the database?

It seems the TableMappings is coming from the file name.

       async Task InitializeAsync()
        {
            if (!initialized)
            {
                if (!Database.TableMappings.Any(m => m.MappedType.Name == typeof(TodoItem).Name))
                {
                    await Database.CreateTablesAsync(CreateFlags.None, typeof(TodoItem)).ConfigureAwait(false);
                    initialized = true;
                }
            }
        }

How do we get value of NEW CheckBox via UITest?

$
0
0

All,

I'm using the new Xamarin.Forms CheckBox widget and I'm trying to get the IsChecked valued when running a UITest. Looking at the app.repl tree I see the widget has a class of "Xamarin_Forms_Platform_iOS_FormsCheckBox" as I'm running the iOS version AND that has a base class of "UIButton".

With all that said, is there a way to get the value of the IsChecked property? I've tried some of the permutations below to no avail:
app.Query(c => c.Id("NameOfCheckBox").Invoke("IsChecked").Value()).First()
app.Query(c => c.Id("NameOfCheckBox").Invoke("isChecked").Value()).First()
app.Query(c => c.Id("NameOfCheckBox").Invoke("on").Value()).First()

Note: They all return TRUE no matter what the checked state is. Any help would be appreciated.

How to pass an Android Intent to another application from Xamarin Forms

$
0
0

I am attempting to pass data from a Xamarin Forms application to another application (Zebra PrintConnect) using an Android Intent. The purpose is to print labels on a Zebra blue tooth printer. I have sample code showing how to implement this using Java. I have not been able to find an example of doing this from Xamarin Forms using C#. Any help would be sincerely appreciated!!

// This method makes your ResultReceiver safe for inter-process communication
private ResultReceiver buildIPCSafeReceiver(ResultReceiver actualReceiver) {
Parcel parcel = Parcel.obtain();
actualReceiver.writeToParcel(parcel, 0);
parcel.setDataPosition(0);
ResultReceiver receiverForSending = ResultReceiver.CREATOR.createFromParcel(parcel);
parcel.recycle();
return receiverForSending;
}

Button templatePrint = (Button) findViewById(R.id.templatePrint);
templatePrint.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// Define a hash map of variable data
// Strings used for keys will be replaced by their corresponding values in your template file's ZPL
HashMap<String, String> variableData = new HashMap<>();
variableData.put("%PRODUCT_NAME%", "Apples");
variableData.put("%MSRP%", "$1.00");
variableData.put("%PCT%", "50");
variableData.put("%FINAL%", "$0.50");
variableData.put("%UPC_CODE%", "12345678");
Intent intent = new Intent();
intent.setComponent(new ComponentName("com.zebra.printconnect",
"com.zebra.printconnect.print.TemplatePrintService"));
intent.putExtra("com.zebra.printconnect.PrintService.TEMPLATE_FILE_NAME", "PriceTagTemplate.zpl");
intent.putExtra("com.zebra.printconnect.PrintService.VARIABLE_DATA", variableData);
intent.putExtra("com.zebra.printconnect.PrintService.RESULT_RECEIVER", buildIPCSafeReceiver(new
ResultReceiver(null) {
@Override
protected void onReceiveResult(int resultCode, Bundle resultData) {
if (resultCode == 0) { // Result code 0 indicates success
// Handle successful print
} else {
// Handle unsuccessful print
// Error message (null on successful print)
String errorMessage = resultData.getString("com.zebra.printconnect.PrintService.ERROR_MESSAGE");
}
}
}));
startService(intent);
}
});

Free or not free?

$
0
0

This isn't necessarily a Xamarin question, so feel free to delete if this is the wrong forum.

I've released a few apps on the App Store -- one was 99 cents (US) with no ads, and the others were free with no ads. For my upcoming game, I'm trying to decide my approach.

Is it still considered a common practice to release a game with ads for free, and then charge 99 cents (or whatever) for an ad-free version? Or is this a legacy strategy that is now frowned upon?

How to pass an Android Intent to another application from Xamarin Forms

$
0
0

// This method makes your ResultReceiver safe for inter-process communication
private ResultReceiver buildIPCSafeReceiver(ResultReceiver actualReceiver) {
Parcel parcel = Parcel.obtain();
actualReceiver.writeToParcel(parcel, 0);
parcel.setDataPosition(0);
ResultReceiver receiverForSending = ResultReceiver.CREATOR.createFromParcel(parcel);
parcel.recycle();
return receiverForSending;
}

Button templatePrint = (Button) findViewById(R.id.templatePrint);
templatePrint.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// Define a hash map of variable data
// Strings used for keys will be replaced by their corresponding values in your template file's ZPL
HashMap<String, String> variableData = new HashMap<>();
variableData.put("%PRODUCT_NAME%", "Apples");
variableData.put("%MSRP%", "$1.00");
variableData.put("%PCT%", "50");
variableData.put("%FINAL%", "$0.50");
variableData.put("%UPC_CODE%", "12345678");
Intent intent = new Intent();
intent.setComponent(new ComponentName("com.zebra.printconnect",
"com.zebra.printconnect.print.TemplatePrintService"));
intent.putExtra("com.zebra.printconnect.PrintService.TEMPLATE_FILE_NAME", "PriceTagTemplate.zpl");
intent.putExtra("com.zebra.printconnect.PrintService.VARIABLE_DATA", variableData);
intent.putExtra("com.zebra.printconnect.PrintService.RESULT_RECEIVER", buildIPCSafeReceiver(new
ResultReceiver(null) {
@Override
protected void onReceiveResult(int resultCode, Bundle resultData) {
if (resultCode == 0) { // Result code 0 indicates success
// Handle successful print
} else {
// Handle unsuccessful print
// Error message (null on successful print)
String errorMessage = resultData.getString("com.zebra.printconnect.PrintService.ERROR_MESSAGE");
}
}
}));
startService(intent);
}
});

How to use onplatform in ResourceDictionary

$
0
0

Hi all i want to add OnPlatform for a setter of style but i want it on code behind not xaml

var Setters = new Setter { Property = Label.FontFamilyProperty, Value = MyProperty };

myStyle.Setters.Add(Setters);

Thanks.


What is replacing AppThemeColor?

How generate a layout with a Button ?

$
0
0
Hello, I'm looking for a way to generate on a page (let's call it ArticlePage) a stacklayout that would have entries thanks to a button (let's call it Add), and when generating it, we stay on the ArticlePage, the stack is added with the Add button underneath and so on... I don't really see how I can make something clean, an idea ? Thank you!

iOS Binding Unity as a library

$
0
0

Hi all,

I don't even know where to start :D

Since alpha 2019.3 Unity offers the feature "Unity as a Library" https://blogs.unity3d.com/2019/06/17/add-features-powered-by-unity-to-native-mobile-apps/ which I'm currently trying to integrate into one of our Xamarin Apps.
There are descriptions how to do that natively for Android and iOS which I got both working fine.
Just for reference:
https://forum.unity.com/threads/integration-unity-as-a-library-in-native-ios-app.685219/
https://forum.unity.com/threads/integration-unity-as-a-library-in-native-android-app.685240/
This is actually a really big deal so it is great working on it :D

However, I got it working fine for Xamarin Android. Now I'm trying on iOS which appears to be much more complicated.

The unity project will be exported as a native Objective-C++ framework (I think at least as there are .mm files using Objective C)
When using Sharpie to bind the framework I get a super large APIDefinitions file.
After some research I figured out that I have to define a scope to the Headers of the Framework, then the APIDefinitions are in fact much smaller and only reference the header files.

Now to my (current) problem:

If I open the ApiDefinitions then there is an interface UnityFramewok which comes from the UnityFramework.h file.
But this header holds a reference to a class UnityView which is not part of the headers. It is within the framework( at least it is within the Library project in Xcode so I assume it is bundled into the framework.)
I copied the .framework into the bindings Native References but I can't see any actual change happening when I do that.
The UnityView can not be found within the interface and I also can't import it from the library because the native reference is not available.

So how can I reference to a class of the framework from within an interface that is defined in the ApiDefinitions?

Thank you already!

Refresh XAML at runtime Localization

$
0
0

Hey everyone,

I try to implement https://forums.xamarin.com/discussion/82458/binding-indexername-and-binding-providevalue-in-xamarin-forms and I got it. Its working with one label.
My issue is with labels from the listview in my MasterDetail page , the labels doesn't change, if someone see what kind of issue, really thanks you.

My View

<ListView Grid.Row="1" x:Name="MenuListPage" SeparatorVisibility="None" 
              HasUnevenRows="true" ItemsSource="{Binding MenuItems}" >
                <ListView.ItemTemplate>
                    <DataTemplate>
                        <ViewCell>
                            <StackLayout Padding="15,10" HorizontalOptions="FillAndExpand">
                                <Label VerticalOptions="FillAndExpand" 
                                VerticalTextAlignment="Center" 
                                Text="{Binding Title}" 
                                FontSize="24"/>
                            </StackLayout>
                        </ViewCell>
                    </DataTemplate>
                </ListView.ItemTemplate>
            </ListView>

When I Change language

 public static void LoadNewLanguageApp(object language)
        {
            var culture = GetCultureInfoFromString(language);

            // Update UI
            DependencyService.Get<ILanguage>().SetLocale(culture);
            Translator.TranslatorInstance.Invalidate();
        }

My Translator class

/// <summary>
    /// Class using singleton design pattern to translate text
    /// </summary>
    public class Translator : INotifyPropertyChanged
    {
        // Path of folder where is store each file language + Name of file without .en ( language code ) 
        private const string ResourceId = "Landauer.Mobile.Ressources.Language.LanguageRessource";

        /// <summary>
        /// Current culture info
        /// </summary>
        private static CultureInfo CultureInfoApp { get; set; }
        /// <summary>
        /// Unique instance of translator
        /// </summary>
        private static readonly Translator _uniqueInstance = new Translator();

        /// <summary>
        /// Public instance of Translator
        /// </summary>
        public static Translator TranslatorInstance => _uniqueInstance;

        // Instanciation differed of Ressourcemanager
        public static readonly Lazy<ResourceManager> RessourceManagerLanguage = new Lazy<ResourceManager>(() => new ResourceManager(ResourceId, IntrospectionExtensions.GetTypeInfo(typeof(TranslateExtension)).Assembly));

        /// <summary>
        /// When TranslateExtension you create new Binding(), call this "Callback"
        /// </summary>
        /// <param name="text"></param>
        /// <returns></returns>
        public string this[string text]
        {
            get
            {
                return RessourceManagerLanguage.Value.GetString(text, CultureInfoApp);
            }
        }
        private void InitCulture()
        {
            if (Device.RuntimePlatform == Device.iOS || Device.RuntimePlatform == Device.Android)
            {
                // Get dependency in each specific platform
                CultureInfoApp = DependencyService.Get<ILanguage>().GetCurrentCultureInfo();
            }
        }
        /// <summary>
        /// Implementation of notifications
        /// </summary>
        public event PropertyChangedEventHandler PropertyChanged;

        /// <summary>
        /// At each time you set language use this method to refresh UI
        /// </summary>
        public void Invalidate()
        {
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(null));
        }
    }

My TranslateExtension

 // Exclude suffix 'Extension', like that in XAML  use Translate
    [ContentProperty("Text")]
    public class TranslateExtension : IMarkupExtension<BindingBase>
    {
        /// <summary>
        /// Match to the name of the label into .resx file
        /// </summary>
        public string Text { get; set; }

        public TranslateExtension()
        {
        }

        public BindingBase ProvideValue(IServiceProvider serviceProvider)
        {
            var binding = new Binding
            {
                Mode = BindingMode.OneWay,
                Path = $"[{Text}]",
                Source = Translator.TranslatorInstance,
            };
            return binding;
        }

        object IMarkupExtension.ProvideValue(IServiceProvider serviceProvider)
        {
            return ProvideValue(serviceProvider);
        }

    }

When I Bind Label of my listview

/// <summary>
        /// List of items available into the main menu
        /// </summary>
        public ObservableCollection<MainMenuViewItem> MenuItems
        {
            get
            {
                return this._menuItems;
            }
            set
            {
                this._menuItems = value; RaisePropertyChanged(() => MenuItems);
            }
        }

        private ObservableCollection<MainMenuViewItem> SetDatas()
        {
            return new ObservableCollection<MainMenuViewItem>
            {
                new MainMenuViewItem {Title = Translator.TranslatorInstance["lblHome"], TargetType=typeof(HybridWebView),ViewModelType=HybridViewTypeEnum.Home },
                new MainMenuViewItem {Title = Translator.TranslatorInstance["lblListOfDeliverySlip"], TargetType=typeof(HybridWebView),ViewModelType=HybridViewTypeEnum.ListDeliverySlip },
                new MainMenuViewItem { Title = Translator.TranslatorInstance["lblSettings"], TargetType=typeof(ParametersView)}
            };
        }
    }

    /// <summary>
    /// Model of items for MainMenuMasterView
    /// </summary>
    public class MainMenuViewItem : INotifyPropertyChanged
    {
        private string _title;
        private HybridViewTypeEnum _viewModelType;
        private Type _targetType;

        public MainMenuViewItem() { }

        public string Title
        {
            get { return this._title; }
            set { this._title=value; OnPropertyChanged(); }
        }

        public HybridViewTypeEnum ViewModelType
        {
            get { return this._viewModelType; }
            set { this._viewModelType = value; OnPropertyChanged(); }
        }
        public Type TargetType
        {
            get { return this._targetType; }
            set { this._targetType =value; OnPropertyChanged(); }
        }

        public event PropertyChangedEventHandler PropertyChanged;

        protected void OnPropertyChanged([CallerMemberName] string propertyName = null)
        {
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
        }
    }

admob pre-launch errors

$
0
0

App works in debug mode on emulator. However, I get the following on pre-launch. cannot figure out how to resolve.

Anyone run into this

Process: com.dnktechnologies.SWLog, PID: 18323\
java.lang.RuntimeException: Unable to get provider com.google.android.gms.ads.MobileAdsInitProvider: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.ads.MobileAdsInitProvider" on path: DexPathList[[zip file "/data/app/com.dnktechnologies.SWLog-7oXNguA79p9Hrsr-w1PFSQ==/base.apk", zip file "/data/app/com.dnktechnologies.SWLog-7oXNguA79p9Hrsr-w1PFSQ==/split_config.arm64_v8a.apk", zip file "/data/app/com.dnktechnologies.SWLog-7oXNguA79p9Hrsr-w1PFSQ==/split_config.xxhdpi.apk"],nativeLibraryDirectories=[/data/app/com.dnktechnologies.SWLog-7oXNguA79p9Hrsr-w1PFSQ==/lib/arm64, /data/app/com.dnktechnologies.SWLog-7oXNguA79p9Hrsr-w1PFSQ==/base.apk!/lib/arm64-v8a, /data/app/com.dnktechnologies.SWLog-7oXNguA79p9Hrsr-w1PFSQ==/split_config.arm64_v8a.apk!/lib/arm64-v8a, /data/app/com.dnktechnologies.SWLog-7oXNguA79p9Hrsr-w1PFSQ==/split_config.xxhdpi.apk!/lib/arm64-v8a, /system/lib64, /product/lib64]]\
at android.app.ActivityThread.installProvider(ActivityThread.java:6988)\
at android.app.ActivityThread.installContentProviders(ActivityThread.java:6528)\
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6445)\
at android.app.ActivityThread.access$1300(ActivityThread.java:219)\
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1859)\
at android.os.Handler.dispatchMessage(Handler.java:107)\
at android.os.Looper.loop(Looper.java:214)\
at android.app.ActivityThread.main(ActivityThread.java:7356)\
at java.lang.reflect.Method.invoke(Native Method)\
at

Viewing all 204402 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>