Reputation: 907
After Xamarin installation in VS 2017 and after creating a cross-platform project in app.xaml.cs I have ten errors and nine warnings from the begginning (without doing anything). I did already a search and I find a solution to update xamarin forms to latest version but xamarin form has the latest version 2.5.0.28
The errors and warnings I get:
Severity Code Description Project File Line Suppression State
Error CS0234 The type or namespace name 'Forms' does not exist in the namespace 'Xamarin' (are you missing an assembly reference?) App1.Android C:\Users\vtsou_000\source\repos\App1\App1\App1\App.xaml.cs 6 Active
Error CS0246 The type or namespace name 'Application' could not be found (are you missing a using directive or an assembly reference?) App1.Android, App1.iOS C:\Users\vtsou_000\source\repos\App1\App1\App1\App.xaml.cs 10 Active
Error CS0115 'App.OnStart()': no suitable method found to override App1.Android, App1.iOS C:\Users\vtsou_000\source\repos\App1\App1\App1\App.xaml.cs 19 Active
Error CS0115 'App.OnSleep()': no suitable method found to override App1.Android, App1.iOS C:\Users\vtsou_000\source\repos\App1\App1\App1\App.xaml.cs 24 Active
Error CS0115 'App.OnResume()': no suitable method found to override App1.Android, App1.iOS C:\Users\vtsou_000\source\repos\App1\App1\App1\App.xaml.cs 29 Active
Error CS0246 The type or namespace name 'Xamarin' could not be found (are you missing a using directive or an assembly reference?) App1.iOS C:\Users\vtsou_000\source\repos\App1\App1\App1\App.xaml.cs 6 Active
Error CS0103 The name 'InitializeComponent' does not exist in the current context App1.Android, App1.iOS C:\Users\vtsou_000\source\repos\App1\App1\App1\App.xaml.cs 14 Active
Error CS0118 'MainPage' is a type but is used like a variable App1.Android, App1.iOS C:\Users\vtsou_000\source\repos\App1\App1\App1\App.xaml.cs 16 Active
Error The type 'Application' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built. App1.iOS C:\Users\vtsou_000\source\repos\App1\App1\App1\App.xaml 2
Error The attachable property 'Resources' was not found in type 'Application'. App1.iOS C:\Users\vtsou_000\source\repos\App1\App1\App1\App.xaml 5
Warning No resource found that matches the given name: attr 'windowNoTitle'. App1.Android C:\Users\vtsou_000\source\repos\App1\App1\App1.Android\Resources\values\styles.xml 2
Warning Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.DarkActionBar'. App1.Android C:\Users\vtsou_000\source\repos\App1\App1\App1.Android\Resources\values\styles.xml 2
Warning No resource found that matches the given name: attr 'windowActionBar'. App1.Android C:\Users\vtsou_000\source\repos\App1\App1\App1.Android\Resources\values\styles.xml 2
Warning No resource found that matches the given name: attr 'colorPrimary'. App1.Android C:\Users\vtsou_000\source\repos\App1\App1\App1.Android\Resources\values\styles.xml 2
Warning No resource found that matches the given name: attr 'colorPrimaryDark'. App1.Android C:\Users\vtsou_000\source\repos\App1\App1\App1.Android\Resources\values\styles.xml 2
Warning No resource found that matches the given name: attr 'colorAccent'. App1.Android C:\Users\vtsou_000\source\repos\App1\App1\App1.Android\Resources\values\styles.xml 3
Warning No resource found that matches the given name: attr 'colorAccent'. App1.Android C:\Users\vtsou_000\source\repos\App1\App1\App1.Android\Resources\values\styles.xml 4
Warning No resource found that matches the given name: attr 'windowActionModeOverlay'. App1.Android C:\Users\vtsou_000\source\repos\App1\App1\App1.Android\Resources\values\styles.xml 4
Warning Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.Dialog'. App1.Android C:\Users\vtsou_000\source\repos\App1\App1\App1.Android\Resources\values\styles.xml 4
I am a new developer in Xamarin so I don't know what to do.
After restarting VS 2017 the old errors are gone but I still get new errors:
[I:sdk]: Key HKCU\SOFTWARE\Xamarin\VisualStudio\15.0_efe5e5bc\Android\AndroidSdkDirectory found:
Path contains adb in \platform-tools (C:\Program Files (x86)\Android\android-sdk).
[I:sdk]: Key HKCU\SOFTWARE\Xamarin\VisualStudio\15.0_efe5e5bc\Android\AndroidNdkDirectory found:
Path contains ndk-stack in \. (C:\ProgramData\Microsoft\AndroidNDK64\android-ndk-r13b).
[I:sdk]: Key HKCU\SOFTWARE\Xamarin\VisualStudio\15.0_efe5e5bc\Android\JavaSdkDirectory found:
Path contains jarsigner.exe in \bin (C:\Program Files\Java\jdk1.8.0_131).
[I:]: Found Xamarin.Android 8.2.0.15
[I:]: Found Android SDK. API levels: 25, 26
[I:]: Found Xamarin.Android 8.2.0.15
[I:sdk]: Runtime path: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Xamarin\Android
[I:sdk]: Framework path: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\ReferenceAssemblies\Microsoft\Framework\MonoAndroid\v1.0
[I:]: Tracking android devices started
[D:]: TrackDeviceTask got:
[I:]: Got new device list from adb with 0 devices
[D:]: live player watcher: got device list from live player with 1 devices
[D:]: Tracking avd started
[D:]: avd watcher *.ini path: 'C:\Users\vtsou_000\.android\avd'
[D:]: avd watcher: got device list from avd with 5 devices
[E:]: an error occurred loading avd `Android_Accelerated_Nougat`, the system image does not exists
[E:]: an error occurred loading avd `Android_ARM_Nougat`, the system image does not exists
[E:]: an error occurred loading avd `Nexus_5_API_24`, the system image does not exists
[E:]: an error occurred loading avd `Nexus_5_API_25`, the system image does not exists
and one more as an error:
Severity Code Description Project File Line Suppression State
Error CS0103 The name 'InitializeComponent' does not exist in the current context App1.Android, App1.iOS C:\Users\vtsou_000\source\repos\App1\App1\App1\App.xaml.cs 14 Active
Upvotes: 0
Views: 2989
Reputation: 907
After many attempts I figure out how to solve my question:
Deleting files from bin and obj is completely unnecessary and my problems didn't disappear.
The first thing I do is to built the solution.
The second is to unload and reload the solution from android. After this I have no errors in my code.
In addition sdk tools are not set properly and emulator don't work properly. So you have to install them. The other thing is on all xaml files in order to share variables. Right click on properties and in built action set to content and after to Embedded resource again.
As I said too many errors from beginning. Microsoft developers must solve those issues.
Upvotes: 2
Reputation: 120
Try the following steps.
1.Close visual studio.
2.Delete Bin & Obj folders in Portable & android projects.
3.Open the Visual studio.
4.Clean the Solution.
5.Rebuild the solution.
Upvotes: 1