0

I am trying to add map on my dashboard screen.

my map code is look like this

Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: Text('Maps Sample App'),
          backgroundColor: Colors.green[700],
        ),
        body: Stack(
      children: <Widget>[
      GoogleMap(initialCameraPosition: CameraPosition(target:
      LatLng(-33.870840,151.206286),
        zoom: 12)
    )
    ],
        )
      ),
    );

i got it from this link.

when i run my code it gives me this error

Plugin project :location_web not found. Please update settings.gradle.

i resolved it by using this solution (Using Peter Haddad solution)

dependencies on pubspec.yaml file are

dependencies:
  intl: ^0.17.0
  flutter:
    sdk: flutter
  analog_clock: ^0.0.1
  get_it: ^6.1.1
  url_launcher: ^5.4.11
  shared_preferences: ^0.5.1+2
 
  dio:
  fluttertoast:
  
  
  google_maps_flutter: ^0.5.30
  location: ^3.0.2

and my settings.gradle file code is


include ':app'

def flutterProjectRoot = rootProject.projectDir.parentFile.toPath()

def plugins = new Properties()
def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins')
if (pluginsFile.exists()) {
    pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) }
}

plugins.each { name, path ->
    def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile()
    include ":$name"
    project(":$name").projectDir = pluginDirectory
}

and here it shows error, i am using analog clock on other screen too.

enter image description here

------update

here is AndriodManifest.xml file

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.attendance_system_app">
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/> 
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
    <uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
    <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:label="attendance_system_app"
        android:usesCleartextTraffic="true"
        android:icon="@mipmap/ic_launcher">
        <meta-data android:name="com.google.firebase.messaging.default_notification_channel_id" android:value="@string/default_notification_channel_id"/>
        <meta-data android:name="com.google.android.geo.API_KEY" android:value="AIzaSyDSBu24ZIgKe96hi27uK-cGugvpheAgaKQ"/>
        <activity
            android:name=".MainActivity"
            android:launchMode="singleTop"
            android:theme="@style/LaunchTheme"
            android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
            android:hardwareAccelerated="true"
            android:windowSoftInputMode="adjustResize">
            <!-- Specifies an Android theme to apply to this Activity as soon as
                 the Android process has started. This theme is visible to the user
                 while the Flutter UI initializes. After that, this theme continues
                 to determine the Window background behind the Flutter UI. -->
            <meta-data
              android:name="io.flutter.embedding.android.NormalTheme"
              android:resource="@style/NormalTheme"
              
              />
            <!-- Displays an Android View that continues showing the launch screen
                 Drawable until Flutter paints its first frame, then this splash
                 screen fades out. A splash screen is useful to avoid any visual
                 gap between the end of Android's launch screen and the painting of
                 Flutter's first frame. -->
            <meta-data
              android:name="io.flutter.embedding.android.SplashScreenDrawable"
              android:resource="@drawable/launch_background"
              />
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>
        <!-- Don't delete the meta-data below.
             This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
        <meta-data
            android:name="flutterEmbedding"
            android:value="2" />
    
    </application>
</manifest>

Update:

logs when run flutter doctor and flutter upgrade command enter image description here

here are the logs when i run command on cmd enter image description here

------update

here is my manifest file, after kernel error happened

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.attendance_system_app">
   <application
        android:label="attendance_system_app"
        android:icon="@mipmap/ic_launcher">
        <activity
            android:name=".MainActivity"
            android:launchMode="singleTop"
            android:theme="@style/LaunchTheme"
            android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
            android:hardwareAccelerated="true"
            android:windowSoftInputMode="adjustResize">
            <!-- Specifies an Android theme to apply to this Activity as soon as
                 the Android process has started. This theme is visible to the user
                 while the Flutter UI initializes. After that, this theme continues
                 to determine the Window background behind the Flutter UI. -->
            <meta-data
              android:name="io.flutter.embedding.android.NormalTheme"
              android:resource="@style/NormalTheme"
              />
            <!-- Displays an Android View that continues showing the launch screen
                 Drawable until Flutter paints its first frame, then this splash
                 screen fades out. A splash screen is useful to avoid any visual
                 gap between the end of Android's launch screen and the painting of
                 Flutter's first frame. -->
            <meta-data
              android:name="io.flutter.embedding.android.SplashScreenDrawable"
              android:resource="@drawable/launch_background"
              />
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>
        <!-- Don't delete the meta-data below.
             This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
        <meta-data
            android:name="flutterEmbedding"
            android:value="2" />
    </application>
</manifest>

Please help me how to fix it.

TimeToCode
  • 1,458
  • 3
  • 18
  • 60

1 Answers1

0

The problem is not for the analog_clock. It is for the location or google_maps_flutter

you added the default_notification_channel_id in the manifest. But this is not found in the resource.

Update: For those who are not able to find "string.xml", you can find it under android>app>src>main>res>values. It is not the same as styles.xml. If you do not have one yet, you can create one:

  1. Right-click the "values" folder,
  2. create New Values Resource with string name,
  3. and create a string with name fcm_default_channel
Moklesur Rahman
  • 543
  • 6
  • 12