About flutter introduction of high moral map plug-connected articles

Plug: https: //pub.flutter-io.cn/packages/amap_base

Reference Signature keystore: https: //blog.csdn.net/weixin_44567104/article/details/90377912

Reference to solve the user key is incorrect or expired, md5 incorrect question: https: //blog.csdn.net/m00123456789/article/details/71404282 tdsourcetag = s_pctim_aiomsg?

amap_base regarded as scores relatively high, but the authors have not been busy updating more problems

1, will generate a keystore file into the root directory. Reference https://blog.csdn.net/weixin_44567104/article/details/90377912

2, the file generating keystore.properties adding configure

= storePassword XXX 
keyPassword = XXX 
keyAlias = XXX 
# Here is loaded under build.gradle app, android.keystore the parent directory is the root directory 
StoreFile = .. / android.keystore

3, app added under configuration build.gradle

// the Load the keystore configuration signature, maps, payment and other services to be used in 
DEF keystorePropertiesFile = rootProject.file ( " keystore.properties " ) 
DEF keystoreProperties = new new the Properties () 
keystoreProperties.load ( new new FileInputStream (keystorePropertiesFile)) 

Android { 

    .. . 
    
    @ signature profile 
    signingConfigs { 
        Debug { 
            keyAlias keystoreProperties [ ' keyAlias ' ] 
            keyPassword keystoreProperties [ ' keyPassword ' ] 
            StoreFile File (keystoreProperties [ 'storeFile'])
            storePassword keystoreProperties['storePassword']
        }
        release {
            keyAlias keystoreProperties['keyAlias']
            keyPassword keystoreProperties['keyPassword']
            storeFile file(keystoreProperties['storeFile'])
            storePassword keystoreProperties['storePassword']
        }
    }

    buildTypes {
        profile {
            initWith debug
        }
        debug {
            signingConfig signingConfigs.debug
        }
        release {
            // TODO: Add your own signing config for the release build.
            // Signing with the debug keys for now, so `flutter run --release` works.
            signingConfig signingConfigs.release
        }
    }

}

4, modify AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<!--包名必须和build.gradle里的applicationId一致-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
          package="xxx">

    <!-- The INTERNET permission is required for development. Specifically,
         flutter needs it to communicate with the running application
         to allow setting breakpoints, to provide hot reload, etc.
    -->
    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.CAMERA" />

    <!-- io.flutter.app.FlutterApplication is an android.app.Application that
         calls FlutterMain.startInitialization(this); in its onCreate method.
         In most cases you can leave this as-is, but you if you want to provide
         additional functionality it is fine to subclass or reimplement
         FlutterApplication and put your custom class here. -->
    <application
        Android: name = "io.flutter.app.FlutterApplication" 
        Android: label = "flutter_module" 
        Android: icon = "@ mipmap / ic_launcher" > 
        <-! Android configuration amap key, ios incoming AMap.init during initialization ( 'ioskey') -> 
        < Meta-Data
             Android: name = "com.amap.api.v2.apikey" 
            Android: value = "Key"  /> 
        ! <- after the package name change default here will find .MainActivity not -> 
        < Activity
             Android: name = "com.example.flutter_module.host.MainActivity" 
            Android: the launchMode = "singleTop"
            android:theme="@style/LaunchTheme"
            android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
            android:hardwareAccelerated="true"
            android:windowSoftInputMode="adjustResize">
            <!-- This keeps the window background of the activity showing
                 until Flutter renders its first frame. It can be removed if
                 there is no splash screen (such as the default splash screen
                 defined in @style/LaunchTheme). -->
            <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>
    </application>
</manifest>

5, some problems have not been signed are basically experience, sha1 and must be on the corresponding packagename, android project configuration should be consistent

 

Guess you like

Origin www.cnblogs.com/nightfallsad/p/11425949.html