Unable to load map_view on fullscreen on Flutter - google-maps

I have an issue when I try to load a google map in fullscreen.
I have followed all the docs in pub.dartland.org for map_view :
in my AndroidManifest.xml I had :
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
Also added :
<meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="your_api_key"/>
<meta-data android:name="com.google.android.gms.version" android:value="#integer/google_play_services_version"/>
Of course with the apiKey changed, and also :
<activity android:name="com.apptreesoftware.mapview.MapActivity" android:theme="#style/Theme.AppCompat.Light.DarkActionBar"/>
I also add the kotlin dependencies in build.graddle.
So now I can see the staticUri map on the device, great, but when I tap on this map to get it in fullscreen, the app crash with this error :
D/AndroidRuntime( 4373): Shutting down VM
E/AndroidRuntime( 4373): FATAL EXCEPTION: main
E/AndroidRuntime( 4373): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.apptreesoftware.mapview.MapActivity}: android.view.InflateException: Binary XML file line #2: Binary XML file line #2: Error inflating class fragment
E/AndroidRuntime( 4373): Caused by: android.view.InflateException: Binary XML file line #2: Binary XML file line #2: Error inflating class fragment
E/AndroidRuntime( 4373): Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class fragment
E/AndroidRuntime( 4373): Caused by: java.lang.RuntimeException: API key not found. Check that <meta-data android:name="com.google.android.geo.API_KEY" android:value="your API key"/> is in the <application> element of AndroidManifest.xml
I tried by adding :
<meta-data android:name="com.google.android.geo.API_KEY" android:value="xxxxxxxxxxxxxxx"/>
But same issue, maybe someone have an idea ?
EDIT :
Here is my AndroidManifest.xml :
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.myapp">
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<application
android:name="io.flutter.app.FlutterApplication"
android:label="my-app"
android:icon="#mipmap/ic_launcher">
<activity
android:name=".MainActivity"
android:launchMode="singleTop"
android:theme="#style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
<meta-data
android:name="io.flutter.app.android.SplashScreenUntilFirstFrame"
android:value="true" />
<meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="XXXXXXXXXXXXXX"/>
<!-- <meta-data android:name="com.google.android.geo.API_KEY" android:value="XXXXXXXXXXXXXXXX"/> -->
<meta-data android:name="com.google.android.gms.version" android:value="#integer/google_play_services_version"/>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity android:name="com.apptreesoftware.mapview.MapActivity" android:theme="#style/Theme.AppCompat.Light.DarkActionBar"/>
</application>
</manifest>

Ok, you need to move the google maps meta-data outside your activity tag , like this:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.myapp">
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<application
android:name="io.flutter.app.FlutterApplication"
android:label="my-app"
android:icon="#mipmap/ic_launcher">
<meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="XXXXXXXXXXXXXX"/>
<meta-data android:name="com.google.android.gms.version" android:value="#integer/google_play_services_version"/>
<activity
android:name=".MainActivity"
android:launchMode="singleTop"
android:theme="#style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
<meta-data
android:name="io.flutter.app.android.SplashScreenUntilFirstFrame"
android:value="true" />
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity android:name="com.apptreesoftware.mapview.MapActivity" android:theme="#style/Theme.AppCompat.Light.DarkActionBar"/>
</application>
</manifest>
You can find more information here:
https://developer.android.com/guide/topics/manifest/meta-data-element
In summary, the metadata is related to the parent component, so in this case you need that metadata for all of the app, not just for one activity :).

Related

ERROR AFTER CHANGING NAMESPACE OF ASP.net MVC PROJECT

Recently i have changed the namespace using the project properties. After that, application was compiling successfully, but at run-time it throws error "The type or namespace name ‘sample’ could not be found (are you missing a using directive or an assembly reference?)".
Error:
Line 23: using System.Web.Routing;
Line 24: using Sample;
Source File: c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files......\App_Web_index.cs Line:
I tried to locate the string “using Sample” and didn’t find anywhere in my solution.
Tried removing the temporary files from framework folder but no luck.
The problem was with my Web.config file
<system.web.webPages.razor>
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<pages pageBaseType="System.Web.Mvc.WebViewPage">
<namespaces>
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Optimization"/>
<add namespace="System.Web.Routing" />
<add namespace="Sample" />
</namespaces>
</pages>
I just replaced the old value "Sample" with new namespace name, and everything starts working again.
Answering so that anyone else has the same issue. There another web.config file under views. please change it there too.

Delphi dcc32 and manifest compilation

How to compile a Delphi project using DCC32.EXE with the default manifest file?
I've compiled some project and the Task Dialog doesn't appear because of missing the manifest file.
When I compile from the IDE everything works fine but when I use the DCC32.EXE the Task Dialog component doesn't work.
I think the problem in the version info file.
Create a file and name it anything.xml
Write the following into the file:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity type="win32" name="App" version="3.1.0.0" processorArchitecture="*"/>
<dependency>
<dependentAssembly>
<assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" publicKeyToken="6595b64144ccf1df" language="*" processorArchitecture="*"/>
</dependentAssembly>
</dependency>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel level="requireAdministrator" uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!--The ID below indicates application support for Windows Vista -->
<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
<!--The ID below indicates application support for Windows 7 -->
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
</application>
</compatibility>
</assembly>
Create a resource file such as proj_manifest.rc and write the following line into it:
1 24 "anything.xml"
Compile the resource file using brcc32.exe
Add the following line to the project source:
{$R 'proj_manifest.res'}
Compile the project using the dcc32.exe and thats all.

ASP.NET Razor Site: "This type of page is not served"

I've created an empty ASP.NET website (i.e. razor web pages) but I'm unable to reach the index.cshtml page.
This is true whether I have 'index.cshtml' in the URL or not.
The error pages says:
Server Error in '/' Application.
This type of page is not served.
Description: The type of page you have requested is not served because
it has been explicitly forbidden. The extension '.cshtml' may be
incorrect. Please review the URL below and make sure that it is
spelled correctly.
Requested URL: /index.cshtml
Here is the entire contents of the web.config
<?xml version="1.0"?>
<configuration>
<appSettings>
<add key="webpages:Enabled" value="true"/>
<add key="webpages:Version" value="3.0.0.0"/>
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.5"/>
<httpRuntime targetFramework="4.5" enableVersionHeader="false" requestValidationMode="2.0"/>
<pages validateRequest="false"/>
</system.web>
<system.webServer>
<security>
<requestFiltering allowDoubleEscaping="true">
<fileExtensions>
<remove fileExtension=".cshtml"/>
<add fileExtension=".cshtml" allowed="true"/>
</fileExtensions>
</requestFiltering>
</security>
<defaultDocument>
<files>
<remove value="index.cshtml"/>
<add value="index.cshtml"/>
</files>
</defaultDocument>
</system.webServer>
</configuration>
Can anyone tell me what I'm missing (or what I've added and which shouldn't be there)?

System.Web.Optimization cannot be used in a razor view file in a Class Library project

I am working in a modularized asp.net mvc4 project. Some views are located in a Class Library project. I already set the web.config to enable the intelligence in razor views. The #model, #Html.* and others are all working well. But when I try to reference a js file in my view by using the #Scripts.Render(). It says cannot find "Scripts". I checked the web.config file. The System.Web.Optimization is in the // node. I also installed Microsoft.AspNet.Web.Optimization package by Nuget.
I tried to type the code in a .cs file to use the System.Web.Optimization members, it works. But I cannot do same thing in the .cshtml file. Even when I typing #using System.Web.Optimization, it prompt me the Optimization cannot be found.
I am not sure what else I can do to resolve this issue. Any clues are very appreciated.
If you have a Web.config at the root of the class library, confirm it contains the following: <add namespace="System.Web.Optimization"/>
If you do not, trick Visual Studio into thinking that it is a web project and enable Intellisense and resolve your issue by adding a web.config file to the root of your class library project (the one that contains the Razor views) with the following contents (taken from this blog post) :
<configuration>
<configSections>
<sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
<section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
</sectionGroup>
</configSections>
<system.web.webPages.razor>
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<pages pageBaseType="System.Web.Mvc.WebViewPage">
<namespaces>
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Optimization"/>
<add namespace="System.Web.Routing" />
</namespaces>
</pages>
</system.web.webPages.razor>
<system.web>
<compilation targetFramework="4.0">
<assemblies>
<add assembly="System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</assemblies>
</compilation>
</system.web>
</configuration>
The above is what worked for me when I faced this issue, but here are more links:
http://forums.asp.net/t/1812274.aspx/1
Getting System.Web.Optimization to work in a razor view within a class library

VS2012 WCF REST Service - Error: Cannot obtain metadata

I have built a WCF REST web service (WCF Service Application) and when I debug with Visual Studio 2012, it will spin up the WCF Test Client app and try to add my web service. I am getting the following error:
Error: Cannot obtain Metadata from http://localhost:50925/Service1.svc If this is a Windows (R) Communication Foundation service to which you have access, please check that you have enabled metadata publishing at the specified address. For help enabling metadata publishing, please refer to the MSDN documentation at http://go.microsoft.com/fwlink/?LinkId=65455.WS-Metadata Exchange Error URI: http://localhost:50925/Service1.svc Metadata contains a reference that cannot be resolved: 'http://localhost:50925/Service1.svc'. Content Type application/soap+xml; charset=utf-8 was not supported by service
I have visited the MSDN document linked above and I believe I have set up my web.config correctly.
Web.config:
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" strict="false" explicit="true" targetFramework="4.0" />
</system.web>
<system.serviceModel>
<services>
<service name="Service1" behaviorConfiguration="Service1Behavior">
<endpoint contract="IMetadataExchange" binding="mexHttpBinding" address="mex"> </endpoint>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="Service1Behavior">
<serviceMetadata httpGetEnabled="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>
I still continue to receive the same error message. I am new to WCF / VS 2012 and .Net 4.0, but I am fluent in VS2008 .Net 2.0.
WCF REST services do not expose metadata, which is why you were getting that message (see more details in this blog post). If you're using the WCF Test Client, it's talking to a SOAP service (endpoint), not a REST one.
If you want to enable a RESTful endpoint, you can define the service element in configuration and define an endpoint inside of it which uses the webHttpBinding, and the endpoint also needs a behaviorConfiguration pointing to an endpoint behavior with the <webHttp/> behavior.
As it turns out I created a new WCF project and looked at what was going on here. VS2012/.Net 4.0 does not like the service configurations with endpoints defined. Here is my new web.config that works fine. I will need to look into why this is but at least it answers my question.
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" strict="false" explicit="true" targetFramework="4.0" />
</system.web>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>