Cannot access AutoSizeableTextView public class ButtonRenderer - xamarin

Visual Studio shows these errors:
error: cannot access AutoSizeableTextView
public class ButtonRenderer
class file for android.support.v4.widget.AutoSizeableTextView not found - file: \obj\Debug\81\android\src\md5f92e0daf340890c9667469657ee2ece8\ButtonRenderer.java
error: cannot access NestedScrollingChild2
public class ItemsViewRenderer
class file for android.support.v4.view.NestedScrollingChild2 not found - file: \obj\Debug\81\android\src\md51558244f76c53b6aeda52c8a337f2c37\ItemsViewRenderer.java
error: cannot access NestedScrollingParent2
public class SwipeDismissBehavior_OnDismissListenerImplementor
class file for android.support.v4.view.NestedScrollingParent2 not found - file: \obj\Debug\81\android\src\mono\android\support\design\widget\SwipeDismissBehavior_OnDismissListenerImplementor.java
error: cannot access TintableImageSourceView
public class ImageButtonRenderer
class file for android.support.v4.widget.TintableImageSourceView not found - file: \obj\Debug\81\android\src\md51558244f76c53b6aeda52c8a337f2c37\ImageButtonRenderer.java
I installed some packages that I think caused the problem: I installed OneSignal, and the AppLinks, that required installing Xamarin.GooglePlayServices.Base and Xamarin.GooglePlayServices.Basement. then had some conflicts between Android specific packages, I removed all packages I installed down to OneSignal. I deleted the bin and obj folder, did clean and build the project, and restarted Visual Studio, but the problem doesn't go away!

It turned out that I installed the package Crosslight.Xamarin.GooglePlayServices.Base by Intersoft Solutions, misled by the package name, while I was trying to download the package by Microsoft, I removed it and now the project works normally

Related

Visual Studio Code deleting class files in target folder

I'm working on multi module Maven project, i built in cmd using mvn clean install/deploy and the build is successful, all the class files in target\class folder are generated.
But when i import this project in VS Code, while opening the projects it is deleting all the class files i.e it deletes target\classes folder in all the projects.
And, VS code doesn't resolve the dependencies in java files until the file is opened.
How do I fix this?
So, when the all the class files are deleted, it is unable to debug the code. While I try to run the code, it shows following error:
Error: Could not find or load main class com.application.Main
Caused by: java.lang.ClassNotFoundException: com.application.Main

Xamarin run error

Severity Code Description Project File Line Suppression State
Error The "Xamarin.Android.Tasks.GetApiLevelFromFramework" task could not be loaded from the assembly C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Build.Tasks.dll. Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask. xamarin_installed_trial
I get this error when I want to run an android program using xamarin.
Android sdk is properly installedhere is the error
Can you check the target platforms are installed correctly. In Visual Studio ->Android SDK MANAGER -> Platforms
You can check
here

Error MSB6006: "java.exe" exited with code 1 when ProGuard enabled

I try to resolve this issue last few days, still without success.
If I build release version without proguard then everything is OK.
I read many topics about possible problems but nothing help in my case.
So far I did as follow:
Java max heap size - 1G
Use "mklink" - mklink /j C:\android-sdk “C:\Program Files (x86)\Android\android-sdk”
Created own proguard.cfg with content:
General Android
-dontwarn org.apache.http.**
-dontwarn android.net.http.AndroidHttpClient
Android Support Library
-keep class android.support.multidex.MultiDexApplication
-keep class android.support.v4.**
-keep class android.support.v7.** {
public *; }
Google Play Billing
-keep class com.android.vending.billing.**
Google Play Services
-dontwarn com.google.android.gms.internal.*
-keep class * extends java.util.ListResourceBundle {
protected java.lang.Object[][] getContents(); }
Manually update ProGuard to latest version.
And the result is 0 warnings and 1 error.
ERROR:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1929,3):
error MSB6006: "java.exe" exited with code 1.
What else can I do?
Please help.
Update.
I created brand new app "Xamarin Hello World" and there "ProGuard" works. So it must be something wrong with my app not a system.
But visual studio doesn't show me any other error apart that Java code 1. So how to track where is a problem?
UPDATE
The problem was in my "proguard.cfg" file. I copy content from other source and one line there should be comment but it wasn't. So this problem gone. But now some warnings come out:
2>PROGUARD : warning : can't write resource [META-INF/MANIFEST.MF](Duplicate zip entry [classes.jar:META-INF/MANIFEST.MF])
2>Copying resources from program jar [G:\ApkiC-Sharp\GNote\GNote\GNote.Android\obj\Release\__library_projects__\Xamarin.GooglePlayServices.Basement\library_project_imports\classes.jar](TaskId:345)
2>PROGUARD : warning : can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry [classes.jar:META-INF/MANIFEST.MF])
2>Copying resources from program jar [G:\ApkiC-Sharp\GNote\GNote\GNote.Android\obj\Release\__library_projects__\Xamarin.GooglePlayServices.Maps\library_project_imports\classes.jar] (TaskId:345)
2>PROGUARD : warning : can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry [classes.jar:META-INF/MANIFEST.MF])
2>Copying resources from program jar [G:\ApkiC-Sharp\GNote\GNote\GNote.Android\obj\Release\__library_projects__\Xamarin.GooglePlayServices.Tasks\library_project_imports\classes.jar] (TaskId:345)
2>PROGUARD : warning : can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry [classes.jar:META-INF/MANIFEST.MF])
What dose it mean? Is it something to worried about?
How to check if "ProGuard" works fine?
I was also facing the same issue on my Windows 10 x64 and visual studio 2015. I have set the JDK path to JDK 1.8 under android settings in Visual studio tools ->options ->xamarin ->java development kit location. it was pointing to "C:\Program Files (x86)\Java\jdk1.7.0_55" and I made it to "C:\Program Files\Java\jdk1.8.0_31", and issue has been fixed.
Try enabling the Multi-Dex compilation option.

Unable to build Xamarin solution on Android

Please tell me how to fix the problem. I updated Xamarin forms dll.
I get the following error:
Error error: cannot find symbol
private native void n_onInflate (android.support.v7.widget.ViewStubCompat p0, android.view.View p1);
symbol: class ViewStubCompat
location: package android.support.v7.widget
obj\Debug\android\src\mono\android\support\v7\widget\ViewStubCompat_OnInflateListenerImplementor.java
Error error: cannot find symbol
public void onInflate (android.support.v7.widget.ViewStubCompat p0, android.view.View p1)
symbol: class ViewStubCompat
location: package android.support.v7.widget
obj\Debug\android\src\mono\android\support\v7\widget\ViewStubCompat_OnInflateListenerImplementor.java
Error error: package android.support.v7.widget.ContentFrameLayout does not exist
android.support.v7.widget.ContentFrameLayout.OnAttachListener
obj\Debug\android\src\mono\android\support\v7\widget\ContentFrameLayout_OnAttachListenerImplementor.java
Error error: package android.support.v7.widget.FitWindowsViewGroup does not exist
android.support.v7.widget.FitWindowsViewGroup.OnFitSystemWindowsListener
\obj\Debug\android\src\mono\android\support\v7\widget\FitWindowsViewGroup_OnFitSystemWindowsListenerImplementor.java
Error error: package android.support.v7.widget.ViewStubCompat does not exist
android.support.v7.widget.ViewStubCompat.OnInflateListener
\obj\Debug\android\src\mono\android\support\v7\widget\ViewStubCompat_OnInflateListenerImplementor.java
Did you "update all Nuget packages"? This will download the incorrect versions of the Google libs. You will have to update the Forms packages manually, they will then pull in the required dependencies.
Also make sure you update the packages in all of your projects (the actual Forms project and the platform specific ones).
Finally, clean the solution and rebuild.
James Montemagno explains the issue perfectly here:
Xamarin Forums
I suspect you have updated all packages which will require manual intervention as described by #Krumelur above.

System.Web.Http.GlobalConfiguration does not contain a definition for 'Configure

In global asax cs file i have this line:
protected void Application_Start()
{
GlobalConfiguration.Configure(WebApiConfig.Register);
}
which causes this error.
I have tried as suggested on other forums:
Open the Package Manager Console for the project with the error.
Type in Install-Package Microsoft.AspNet.WebApi.WebHost and hit Enter
Rebuild your project and all should be right with the world (or at least right with your project)
The output was:
Attempting to resolve dependency 'Microsoft.AspNet.WebApi.Core (≥ 5.2.2 && < 5.3.0)'.
Attempting to resolve dependency 'Microsoft.AspNet.WebApi.Client (≥ 5.2.2)'.
Attempting to resolve dependency 'Newtonsoft.Json (≥ 6.0.4)'.
'Microsoft.AspNet.WebApi.WebHost 5.2.2' already installed.
SM.EORD.Web already has a reference to 'Microsoft.AspNet.WebApi.WebHost 5.2.2'.
and error is still there. What could be wrong?
br, Simon
After hours of investigating i have found out that after I have installed ASP.NET Web API 2.2, the reference path of all dlls was from some old Web API - it didn't take the new ones.
The new dlls has been installed in packages folder, while the old one were in bin folder inside project.
if you want to update your references as well next time try upgrading from the package manager console you can update all or just specify the package name. Update package will upgrade vs installing a new package and you have manually go update your references.
Update-Package
In my case, the problem was that I renamed the Namespace of my project, and I did not know I needed to manually edit the namespaces section of the Views\Web.Config to match my new namespace.

Resources