Incorrect version number apk - visual-studio-2010

I have the following problem.
We have build an app with mono for android. The first version was no problem.
versionnumber was 1.0 and that is correct.
Meanwhile we have an update ready for this app. I changed the versionnumber in the manifest from '1' to '2'
and the versionname from '1.0' to '1.1'. But after I install the app on my phone I still see version '1.0'.
Also when I try to update de app in the market I get the error:
"The new apk's versioncode (1) already exists." (I'm sure I changed the versioncode to '2' in the manifest.)
What is going wrong?
Goldhorn

Did you change versionCumber or versionCode?
The correct attribute is versionCode (I don't know about versionNumber):
android:versionCode="1" android:versionName="0.1"
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
android:installLocation="preferExternal"
package="com.jamwarehouse.apps.evolution"
android:versionCode="1"
android:versionName="0.1">
<application android:label="Evolution">
</application>
<uses-sdk android:minSdkVersion="4" />
</manifest>
Anyway, if you are using Mono for Android, you shouldn't need to edit the AndroidManifest.xml at all. You use C# attributes on your classes and you edit the version details via the project properties:
[Activity(Label = "Timeband", MainLauncher = true, Icon = "#drawable/icon")]
public class TimebandActivity : Activity
{
...
}
Note: I did notice that if I edited a field and then pressed close of the tab, it didn't save. You have to click out of the text boxes first, then close/save.

I Have found the problem.
I had to include my AndroidManifest.xml in my .csproj file. After that I had to add some more configurations from the C# code to the androidmanifest. I now use both the C# attributes and a manual AndroidManifest (which will be combined by Mono for Android).

Related

Preserving ICommand during Linking

In my Xamarin.Forms code I use ICommand several times for creating hyperlinks.
The code works fine during debugging, but the command gets removed during release by the linker.
I created an XML file in the root of my Android project with its Build Action set to LinkDescription, that has the following code:
<?xml version="1.0" encoding="utf-8" ?>
<linker>
<assembly fullname="System">
<type fullname="System.Windows.Input.ICommand"></type>
</assembly>
</linker>
I expected that would preserve the command, but no; the links again don't work during release. Am I doing something wrong?
I don't know why the XML solution did not work, but here is what worked in my case:
Using the [Preserve] attribute before each ICommand had the desired effect during Release!
You've got the wrong assembly. The easiest way to figure out the right assembly is to CTRL + Click the symbol ICommand in a Xamarin project, which will open a decompiler window with the assembly in a #region at the top of the file.
#region Assembly netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51
// C:\Program Files\dotnet\sdk\NuGetFallbackFolder\netstandard.library\2.0.3\build\netstandard2.0\ref\netstandard.dll
#endregion
Now change the XML to:
<?xml version="1.0" encoding="utf-8" ?>
<linker>
<assembly fullname="netstandard">
<type fullname="System.Windows.Input.ICommand" />
</assembly>
</linker>

Xamarin.Forms open downloaded pdf directly

I'm able to save a pdf file locally on the phone in the downloads folder. Now I want to be able to open the file in the generic pdf viewer. This is the file I have for example:
When opening directly from the downloads folder I'm getting this view:
How can I open the document in the same viewer as soon as the document is downloaded?
I tried this:
Device.OpenUri(new System.Uri("file:///storage/emulated/0/Download/740067_Invoice_Food.pdf"));
But nothing is happening.
Try this approach, maybe you'll need to change folder path using Environment.SpecialFolder
var documents = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
var filename = Path.Combine(documents, "MyPDF.pdf");
Device.OpenUri(new Uri(filename));
First specify fileprovider into android manifest file
Something like this
<application android:label="The name of your project" android:supportsRtl="true" android:icon="#drawable/register">
<provider android:name="android.support.v4.content.FileProvider" android:authorities="${applicationId}.fileprovider" android:exported="false" android:grantUriPermissions="true">
<meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="#xml/provider_paths"></meta-data>
</provider>
</application>
Next, add provider_paths.xml file into xml folder
<?xml version="1.0" encoding="utf-8"?>
<paths xmlns:android="http://schemas.android.com/apk/res/android">
<external-path name="external_files" path="."/>
</paths>
Now you should call native method for each platform by 'DependencyService' to open pdf file
Do it according to this GREAT Doc
https://officialdoniald.azurewebsites.net/2019/09/24/xamarin-forms-save-and-open-pdf-file/

Xcode GUI Design: Opening a El Capitan Storyboard file in Yosemite

Is it possible to to create a storyboard-based app in OS X El Capitan 10.11 and open it in Yosemite with the same xCode Version (7.3.1)
I get the following warning:
I've tried changing settings in file inspector - without luck. Builds for is set to 'deployment target 10.9' and opens in to 'Xcode 7'
Has anyone dealt with this scenario already?
UPDATE: This seems to be related to stack views... If I remove all stack views, the .storyboard file no longer has the tag as shown below.
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="10117" systemVersion="15G31" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" initialViewController="B8D-0N-5wS">
<dependencies>
<deployment version="1090" identifier="macosx"/>
<development version="7000" identifier="xcode"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="10117"/>
<capability name="stacking Non-gravity area distributions on NSStackView" minToolsVersion="7.0" minSystemVersion="10.11"/>
</dependencies>
...
I don't understand this behaviour: If stack views are not fully supported or don't behave the same way earlier OS versions, there should at least be warning when I choose "deployment target 10.9"! Better yet, Xcode should disable the stack views altogether if that's the case!

No resource identifier found for attribute 'MvxBind' in package in Xamarin Android app

I'm using Xamarin Studio v5.10.1 and Xamarin Android v6.0.0.34 and MvvmCross v3.5.1.
I keep getting this error message when I build the solution:
No resource identifier found for attribute 'MvxBind' in package my.package
I've seen all the question in stack overflow regarding this error but nothing helped.
Here is what I tried:
Clean everything and rebuild
Used res-auto instead of my package name
Upgrade to the latest Mono Android
It seems that the file MvxBindingAttributes.xml is not copied to the Resources/Values folder. I assume it is supposed to be extract from Cirrious.MvvmCross.Binding.Droid.dll but somehow it doesn't.
I also tried creating the MvxBindingAttributes.xml file myself in the right place. It fixed the compilation error but a runtime error complaining about the same thing (resource id's not found).
Adding the MvxBindingAttributes.xml to the Resources/values folder in the solution worked for me.
https://github.com/MvvmCross/MvvmCross/blob/3.5/Cirrious/Cirrious.MvvmCross.Binding.Droid/Resources/values/MvxBindingAttributes.xml
I am also using xmlns:local="http://schemas.android.com/apk/res-auto" in the axml file
For me, my namespace in the XAML wasn't defined correctly...
I had:
xmlns:local="http://schemas.android.com/apk/res/AndroidApp1.Resource"
...
local:MvxBind
But the namespace of my app (in project properties) was AndroidApp1.AndroidApp1 (its a PoC :)).
So when I fixed that - it all worked:
xmlns:local="http://schemas.android.com/apk/res/AndroidApp1.AndroidApp1"
...
local:MvxBind
In my case, I mistyped the package name in the android manifest. Ensure that your xmlns:local attribute in the .axml file match the package name.
YOUR-PACKAGE-NAME must be the same here...
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:local="http://schemas.android.com/apk/res/YOUR-PACKAGE-NAME"
android:layout_width="match_parent"
android:layout_height="match_parent">
and here
Hope it helps
OK. I just checked. It doesn't seem like the NuGet actually installs MvxBindingAttributes.xml into the Resources\values folder. So you have to create it yourself:
The contents need to be this: https://github.com/MvvmCross/MvvmCross/blob/3.5/Cirrious/Cirrious.MvvmCross.Binding.Droid/Resources/values/MvxBindingAttributes.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable name="MvxBinding">
<attr name="MvxBind" format="string"/>
<attr name="MvxLang" format="string"/>
</declare-styleable>
<declare-styleable name="MvxControl">
<attr name="MvxTemplate" format="string"/>
</declare-styleable>
<declare-styleable name="MvxListView">
<attr name="MvxItemTemplate" format="string"/>
<attr name="MvxDropDownItemTemplate" format="string"/>
</declare-styleable>
<declare-styleable name="MvxExpandableListView">
<attr name="MvxGroupItemTemplate" format="string"/>
</declare-styleable>
<item type="id" name="MvxBindingTagUnique"/>
<declare-styleable name="MvxImageView">
<attr name="MvxSource" format="string"/>
</declare-styleable>
</resources>
EDIT:
This information is not valid for MvvmCross 4.x where MvxBindingAttributes.xml is included in the MvvmCross.Binding package. This means, that it is no longer necessary to include this file yourself or through a NuGet into your project.
I know this question is real old but if you are having this error in Xamarin Studio version 6.1.5 and MvvmCross version 4.4.0 make sure you are creating a "Blank Android App" instead of a "Android App" This makes sure that no packages are included by default that will not play with with MvvmCross off the bat.
Try adding a reference from Manage NuGet Packages and from the search tap write MvvmCross.Bind and then install it.
I know it is old topic but I found another solution.
When you create new project remember to name core: name.Core and android app: name.Droid . It solved all my problems.

Error: The element <ParameterGroup> beneath element <UsingTask> is unrecognized

I am receiving this error, when building the solution using the msbuild.
The element <ParameterGroup> beneath element <UsingTask> is
unrecognized.
The error is showing both in msbuild and in Visual Studio.
This is because one of your project is targeting .NET 3.5.
All of your projects should be targeted to .NET 4.0 at least.
If your .cs project does not allow to view or change the Target Framework, as it was in my situation: You will need to change it manually in .csproj.
Open the .csproj in notepad.
In this line
<Project ToolsVersion="3.5"...
change the ToolsVersion to at least 4.0.
Other possibility, is that you are using <UsingTask> inside a <Target> element.
You MUST declare it outside the <Target />.
Tested on 2017 and 2019.
The error is the following otherwise. (I would bet this is #Crono sees with Roslyn).
proj(2300,5): error MSB4067: L'élément "ParameterGroup" situé sous l'élément <UsingTask> n'est pas reconnu.
Just copy the config below and create a specflow.exe.config file
Put this config file next to your specflow.exe and you will be able to create the nunitexecutionreport report.
also can use this link https://github.com/techtalk/SpecFlow/wiki/Reporting
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0.30319" />
</startup>
</configuration>

Resources