API KEY ERROR

Hi, i have an issue with MapView and its with the API Key, i don’t know what its going on, i write like the example says but the Android preview show to me an ERROR: java.lang.IllegalStateException: A required meta-data tag in your app’s AndroidManifest.xml does not exist.

Please post the entire log output you get when trying to build.

This is the log output i get:

LOG: Uno.Exception: java.lang.IllegalStateException: A required meta-data tag in your app's AndroidManifest.xml does not exist.  You must have the following declaration within the <application> element:     <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
       at Android.Base.JNI.TryGetException(Android.Base.Primitives.JNIEnvPtr,[string])
       at Android.Base.JNI.CheckException(Android.Base.Primitives.JNIEnvPtr,[string])
       at Android.Base.JNI.CheckException(Android.Base.Primitives.JNIEnvPtr)
       at Android.Base.Wrappers.JavaObjectHelper.JObjectToJWrapper(Android.Base.Primitives.ujobject,bool)
       at Fuse.Controls.MapView.CreateNativeView()
       at Fuse.Controls.Control.InjectTemplate()
       at Fuse.Controls.Control.OnRooted()
       at Fuse.Controls.LayoutControl.OnRooted()
       at Fuse.Controls.Panel.OnRooted()
       at Fuse.Node.RootInternalImpl(Fuse.Visual)
       at Fuse.Node.RootInternal(Fuse.Visual)
       at Fuse.Visual.OnRooted()
       at Fuse.Elements.Element.OnRooted()
       at Fuse.Controls.Control.OnRooted()
       at Fuse.Controls.LayoutControl.OnRooted()
       at Fuse.Controls.NativeViewHost.OnRooted()
       at Fuse.Node.RootInternalImpl(Fuse.Visual)
       at Fuse.Node.RootInternal(Fuse.Visual)
       at Fuse.Visual.OnRooted()
       at Fuse.Elements.Element.OnRooted()
       at Fuse.Controls.Control.OnRooted()
       at Fuse.Controls.LayoutControl.OnRooted()
       at Fuse.Controls.Panel.OnRooted()
       at Fuse.Node.RootInternalImpl(Fuse.Visual)
       at Fuse.Node.RootInternal(Fuse.Visual)
       at Fuse.Visual.OnRooted()
       at Fuse.Elements.Element.OnRooted()
       at Fuse.Controls.Control.OnRooted()
       at Fuse.Controls.ScrollViewBase.OnRooted()
       at Fuse.Controls.ScrollView.OnRooted()
       at Fuse.Node.RootInternalImpl(Fuse.Visual)
       at Fuse.Node.RootInternal(Fuse.Visual)
       at Fuse.Visual.OnRooted()
       at Fuse.Elements.Element.OnRooted()
       at Fuse.Controls.Control.OnRooted()
       at Fuse.Controls.LayoutControl.OnRooted()
       at Fuse.Controls.Panel.OnRooted()
       at Fuse.Node.RootInternalImpl(Fuse.Visual)
       at Fuse.Node.RootInternal(Fuse.Visual)
       at Fuse.Visual.OnRooted()
       at Fuse.Elements.Element.OnRooted()
       at Fuse.Controls.Control.OnRooted()
       at Fuse.Controls.LayoutControl.OnRooted()
       at Fuse.Controls.Panel.OnRooted()
       at Fuse.Controls.EdgeNavigator.OnRooted()
       at Fuse.Node.RootInternalImpl(Fuse.Visual)
       at Fuse.Node.RootInternal(Fuse.Visual)
       at Fuse.Visual.OnRooted()
       at Fuse.Elements.Element.OnRooted()
       at Fuse.Controls.Control.OnRooted()
       at Fuse.Controls.LayoutControl.OnRooted()
       at Fuse.Controls.Panel.OnRooted()
       at Fuse.Controls.Page.OnRooted()
       at Fuse.Node.RootInternalImpl(Fuse.Visual)
       at Fuse.Node.RootInternal(Fuse.Visual)
       at Fuse.Node.Relate(Fuse.Visual,Fuse.Node)
       at Fuse.Visual.OnAdded(Fuse.Node)
       at Fuse.Visual.Insert(int,Fuse.Node)
       at Fuse.Visual.Add(Fuse.Node)
       at Fuse.Controls.Navigator.Prepare(Fuse.Controls.Navigator.NavPage,string&,string&,Fuse.Navigation.RoutingOperation,Fuse.Visual&,bool&)
       at Fuse.Controls.Navigator.Fuse.Navigation.IRouterOutlet.Goto(string&,string&,Fuse.Navigation.NavigationGotoMode,Fuse.Navigation.RoutingOperation,string,Fuse.Visual&)
       at Fuse.Navigation.Router.SetRouteImpl(Fuse.Visual,Fuse.Navigation.Route,Fuse.Navigation.NavigationGotoMode,Fuse.Navigation.RoutingOperation,string,Fuse.Navigation.IRouterOutlet&)
       at Fuse.Navigation.Router.SetRoute(Fuse.Navigation.Route,Fuse.Navigation.NavigationGotoMode,Fuse.Navigation.RoutingOperation,string,[bool])
       at Fuse.Navigation.Router.Modify(Fuse.Navigation.ModifyRouteHow,Fuse.Navigation.Route,Fuse.Navigation.NavigationGotoMode,string)
       at Fuse.Navigation.Router.Push(Fuse.Navigation.Route,[string])
       at Fuse.Navigation.Router.Push(Fuse.Scripting.Context,Fuse.Navigation.Router,object[])
       at Fuse.Scripting.ScriptMethod`1.CallClosure.Run()
       at Fuse.UpdateManager.ProcessPostActionsImpl()
       at Fuse.UpdateManager.ProcessPostActions()
       at Fuse.UpdateManager.Update()
       at Outracks.Simulator.Application.OnUpdate()
       at Fuse.App.OnTick(object,Uno.Platform.TimerEventArgs)
       at Uno.Platform.Display.OnTick(Uno.Platform.TimerEventArgs)
       at Uno.Platform.AndroidDisplay.OnFrameCallback(double,double)
LOG: InternalError: Failed to properly reset. Try exiting Fuse and restarting.: Incomplete or duplicate unrooting: Fuse.Controls.Page, Name: state/state in Outracks.Simulator.GeneratedApplication</usr/local/share/uno/Packages/Outracks.Simulator.Client.Uno/0.1.0/$.uno:94>
ERROR: java.lang.IllegalStateException: A required meta-data tag in your app's AndroidManifest.xml does not exist.  You must have the following declaration within the <application> element:     <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
    Uno.Exception occured.
       at Android.Base.JNI.TryGetException(Android.Base.Primitives.JNIEnvPtr,[string])
       at Android.Base.JNI.CheckException(Android.Base.Primitives.JNIEnvPtr,[string])
       at Android.Base.JNI.CheckException(Android.Base.Primitives.JNIEnvPtr)
       at Android.Base.Wrappers.JavaObjectHelper.JObjectToJWrapper(Android.Base.Primitives.ujobject,bool)
       at Fuse.Controls.MapView.CreateNativeView()
       at Fuse.Controls.Control.InjectTemplate()
       at Fuse.Controls.Control.OnRooted()
       at Fuse.Controls.LayoutControl.OnRooted()
       at Fuse.Controls.Panel.OnRooted()
       at Fuse.Node.RootInternalImpl(Fuse.Visual)
       at Fuse.Node.RootInternal(Fuse.Visual)
       at Fuse.Visual.OnRooted()
       at Fuse.Elements.Element.OnRooted()
       at Fuse.Controls.Control.OnRooted()
       at Fuse.Controls.LayoutControl.OnRooted()
       at Fuse.Controls.NativeViewHost.OnRooted()
       at Fuse.Node.RootInternalImpl(Fuse.Visual)
       at Fuse.Node.RootInternal(Fuse.Visual)
       at Fuse.Visual.OnRooted()
       at Fuse.Elements.Element.OnRooted()
       at Fuse.Controls.Control.OnRooted()
       at Fuse.Controls.LayoutControl.OnRooted()
       at Fuse.Controls.Panel.OnRooted()
       at Fuse.Node.RootInternalImpl(Fuse.Visual)
       at Fuse.Node.RootInternal(Fuse.Visual)
       at Fuse.Visual.OnRooted()
       at Fuse.Elements.Element.OnRooted()
       at Fuse.Controls.Control.OnRooted()
       at Fuse.Controls.ScrollViewBase.OnRooted()
       at Fuse.Controls.ScrollView.OnRooted()
       at Fuse.Node.RootInternalImpl(Fuse.Visual)
       at Fuse.Node.RootInternal(Fuse.Visual)
       at Fuse.Visual.OnRooted()
       at Fuse.Elements.Element.OnRooted()
       at Fuse.Controls.Control.OnRooted()
       at Fuse.Controls.LayoutControl.OnRooted()
       at Fuse.Controls.Panel.OnRooted()
       at Fuse.Node.RootInternalImpl(Fuse.Visual)
       at Fuse.Node.RootInternal(Fuse.Visual)
       at Fuse.Visual.OnRooted()
       at Fuse.Elements.Element.OnRooted()
       at Fuse.Controls.Control.OnRooted()
       at Fuse.Controls.LayoutControl.OnRooted()
       at Fuse.Controls.Panel.OnRooted()
       at Fuse.Controls.EdgeNavigator.OnRooted()
       at Fuse.Node.RootInternalImpl(Fuse.Visual)
       at Fuse.Node.RootInternal(Fuse.Visual)
       at Fuse.Visual.OnRooted()
       at Fuse.Elements.Element.OnRooted()
       at Fuse.Controls.Control.OnRooted()
       at Fuse.Controls.LayoutControl.OnRooted()
       at Fuse.Controls.Panel.OnRooted()
       at Fuse.Controls.Page.OnRooted()
       at Fuse.Node.RootInternalImpl(Fuse.Visual)
       at Fuse.Node.RootInternal(Fuse.Visual)
       at Fuse.Node.Relate(Fuse.Visual,Fuse.Node)
       at Fuse.Visual.OnAdded(Fuse.Node)
       at Fuse.Visual.Insert(int,Fuse.Node)
       at Fuse.Visual.Add(Fuse.Node)
       at Fuse.Controls.Navigator.Prepare(Fuse.Controls.Navigator.NavPage,string&,string&,Fuse.Navigation.RoutingOperation,Fuse.Visual&,bool&)
       at Fuse.Controls.Navigator.Fuse.Navigation.IRouterOutlet.Goto(string&,string&,Fuse.Navigation.NavigationGotoMode,Fuse.Navigation.RoutingOperation,string,Fuse.Visual&)
       at Fuse.Navigation.Router.SetRouteImpl(Fuse.Visual,Fuse.Navigation.Route,Fuse.Navigation.NavigationGotoMode,Fuse.Navigation.RoutingOperation,string,Fuse.Navigation.IRouterOutlet&)
       at Fuse.Navigation.Router.SetRoute(Fuse.Navigation.Route,Fuse.Navigation.NavigationGotoMode,Fuse.Navigation.RoutingOperation,string,[bool])
       at Fuse.Navigation.Router.Modify(Fuse.Navigation.ModifyRouteHow,Fuse.Navigation.Route,Fuse.Navigation.NavigationGotoMode,string)
       at Fuse.Navigation.Router.Push(Fuse.Navigation.Route,[string])
       at Fuse.Navigation.Router.Push(Fuse.Scripting.Context,Fuse.Navigation.Router,object[])
       at Fuse.Scripting.ScriptMethod`1.CallClosure.Run()
       at Fuse.UpdateManager.ProcessPostActionsImpl()
       at Fuse.UpdateManager.ProcessPostActions()
       at Fuse.UpdateManager.Update()
       at Outracks.Simulator.Application.OnUpdate()
       at Fuse.App.OnTick(object,Uno.Platform.TimerEventArgs)
       at Uno.Platform.Display.OnTick(Uno.Platform.TimerEventArgs)
       at Uno.Platform.AndroidDisplay.OnFrameCallback(double,double)

Hi Rodrigo, I’ll jump into this too. Could you post your unoproj file. Usually the reason for the gms stuff not being set is Uno not seeing the api key in your unoproj

Hey Chris, This my unoproj:
{
“RootNamespace”:“Zeo.Pettz”,
“Android”:{
“Package”: “com.Zeo.Pettz”,
“PreviewPackage”: “com.Zeo.Pettz.preview”,
“Geo”:{
“com.google.android.geo.API_KEY”:“AIzaSyB6SayIseHqfozDaLGyTd1FCqOEi2ZKMjo”
}
},
“Packages”: [
“Fuse.Maps”,
“Fuse”,
“FuseJS”,
“Fuse.GeoLocation”
],
“Includes”: [
",
"Modules/
”,
“Pages/*.js:Bundle”
]
}

Rodrigo wrote:

Hey Chris, This my unoproj:

{
“RootNamespace”:“Zeo.Pettz”,
“Android”:{
“Package”: “com.Zeo.Pettz”,
“PreviewPackage”: “com.Zeo.Pettz.preview”,
“Geo”:{
“com.google.android.geo.API_KEY”:“AIzaSyB6SayIseHqfozDaLGyTd1FCqOEi2ZKMjo”
}
},
“Packages”: [
“Fuse.Maps”,
“Fuse”,
“FuseJS”,
“Fuse.GeoLocation”
],
“Includes”: [
",
"Modules/
”,
“Pages/*.js:Bundle”
]
}

Cool, I see the problem, the way you have added the api-key is incorrect. Have a peek at documentation here: https://www.fusetools.com/docs/fuse/controls/mapview

Here is the important section:

Google Maps requires a valid Google Maps API key. Follow Google's 
documentation to get one set up. Once you have your key it must be 
added to your project file, as shown below

 "Android": {
   "Geo": {
        "ApiKey": "your_key_here"
    }
}

In your unoproj you have:

  "Android": {
    "Geo": {
      "com.google.android.geo.API_KEY": "AIzaSyB6SayIseHqfozDaLGyTd1FCqOEi2ZKMjo"
    },
    "PreviewPackage": "com.Zeo.Pettz.preview",
    "Package": "com.Zeo.Pettz"
  }

So try changing com.google.android.geo.API_KEY to ApiKey

I hope this helps!

thank’s a lot, i’ll try this

Thank you very much Chris Bagley this solve the problem, so thanks a lot.