简体   繁体   English

Android App Map Fragment在发行版本中未显示

[英]Android App Map Fragment not showing in release version

I've created a small android app using a Map Fragment and been testing it using jetbrains-studio. 我使用Map Fragment创建了一个小型的android应用,并使用jetbrains-studio对其进行了测试。 I've obtained an API key and it works fine, whether the phone is plugged into the laptop via the USB cable or whether I carry it around standalone (I need to do this as it has a tracking element involved). 我已经获得了API密钥,无论手机是通过USB电缆插入笔记本电脑还是随身携带(无论是否包含跟踪元素,我都需要这样做),它都能正常工作。

I have "Maps SDK for Android" API enabled via the APIs and services dashboard. 我已通过API和服务信息中心启用了“ Maps SDK for Android” API。

When I uploaded the App I went to "App signing" and downloaded the Google certificate, called "deployment_cert.der". 当我上传应用程序时,我转到“应用程序签名”并下载了名为“ deployment_cert.der”的Google证书。 When it came time to compile my app, 当需要编译我的应用程序时,

keytool -importcert -file deployment_cert.der -keystore keystore.jks keytool -importcert-文件deployment_cert.der -keystore keystore.jks

(keystore was the file created when I went to compile the release version of the app as a signed apk; when I uploaded the app, Google didn't grumble and accepted it) (密钥库是我去编译该应用的发行版作为签名的apk时创建的文件;当我上传该应用时,谷歌并没有抱怨并接受它)

I got my wife to test out the app by downloading from the playstore on her phone and tablet but instead of the map, I get a grey box, with the Google logo in the corner, +/- zoom buttons and the "home centre" circle in the top right hand corner. 我让我的妻子通过从手机和平板电脑上的Playstore下载来测试该应用程序,但没有显示地图,而是一个灰色框,上面带有Google徽标,+ /-缩放按钮和“居家中心”在右上角圆圈。 Everything else on the app is working. 该应用程序上的其他所有内容均正常运行。

I don't have a clue what could be wrong? 我不知道有什么问题吗? Could someone please provide some hints? 有人可以提供一些提示吗? I am stumped as to what to look for. 我对寻找的东西感到困惑。

I've checked device compatibility and all the devices I've used are listed in the device directory as being OK. 我已经检查了设备的兼容性,并且我使用过的所有设备都在设备目录中列为“确定”。

My Manifest file is as follows: 我的清单文件如下:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mydomain.ge">

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>


<application
    android:allowBackup="true"
    android:icon="@drawable/gmarkerblank"
    android:label="@string/app_name"
    android:roundIcon="@mipmap/ic_launcher_round"
    android:supportsRtl="true"
    android:theme="@style/AppTheme">

    <meta-data
        android:name="com.google.android.geo.API_KEY"
        android:value="@string/google_maps_key" />

    <activity
        android:name=".GE"
        android:label="@string/title_activity_ge">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>


</application>

My build.gradle file is: 我的build.gradle文件是:

apply plugin: 'com.android.application'

android {
compileSdkVersion 27
defaultConfig {
    applicationId "com.mydomain.ge"
    minSdkVersion 15
    targetSdkVersion 27
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    multiDexEnabled true
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.google.android.gms:play-services-maps:15.0.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
//implementation 'com.google.android.gms:play-services:12.0.1'
implementation 'com.android.support:multidex:1.0.3'
implementation 'com.android.support:design:27.1.1'
implementation 'com.github.pengrad:mapscaleview:1.4.1'

}

My activity file is as follows: 我的活动文件如下:

<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:map="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:weightSum="1"
android:id="@+id/tlll"
>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/llhelpgraphic"
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:layout_weight=".08"
    android:background="#000000"
    android:orientation="horizontal">

    <ImageButton
        android:id="@+id/helpButton"
        android:layout_height="match_parent"
        android:layout_width="wrap_content"
        android:layout_margin="3dp"
        android:adjustViewBounds="true"
        android:src="@drawable/help5"
        />

    <ImageView
        android:id="@+id/titleview"
        android:layout_height="match_parent"
        android:layout_width="fill_parent"
        android:layout_weight="1"
        android:src="@drawable/title"
        />

</LinearLayout>

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/frlayout"
    android:layout_weight=".82"
    android:layout_width="match_parent"
    android:layout_height="0dp"
    >

    <fragment xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:map="http://schemas.android.com/apk/res-auto"
        xmlns:tools="http://schemas.android.com/tools"
        android:id="@+id/map"
        android:name="com.google.android.gms.maps.SupportMapFragment"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        tools:context=".GE" />

</FrameLayout>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:layout_weight=".10"
    android:background="#004D79"
    android:orientation="horizontal">

    <EditText
        android:id="@+id/addressText"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_marginLeft="10dp"
        android:layout_marginTop="7dp"
        android:layout_weight="1"
        android:background="#FFFFFF"
        android:text="Enter UK address or postcode">
    </EditText>

    <Button
        android:id="@+id/findButton"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_margin="5dp"
        android:text="Find">
    </Button>
</LinearLayout>

Basically, what this produces is, a top row containing an image button, then next to it, filling up the rest of the row is the title of the app Then below is the map, filling up the most of the space The very bottom is a row containing a text edit box, and a button on the right hand side. 基本上,这就是生成的内容,在最上面一行包含一个图像按钮,然后在其旁边填充应用程序的标题,然后填充地图其余部分,然后在地图下方填充大部分空间。最底部是包含文本编辑框和右侧按钮的行。 I can't see anything obviously amiss in the source code 我在源代码中看不到任何明显的问题

Your app generates different SHA-1 fingerprints depending on your build variant. 您的应用会根据您的构建变体生成不同的SHA-1指纹。

Also when you use Google's App Signing, Google generates a SHA-1 fingerprint for you when you upload your apk, so you need to add that fingerprint in your Google Cloud Platform Console like you did with your debug fingerprint. 同样,当您使用Google的应用签名时,当您上传apk时,Google会为您生成SHA-1指纹,因此您需要像使用调试指纹那样在Google Cloud Platform Console中添加该指纹。

You can view the generated fingerprint by going to Google Play Console -> Release Management -> App signing 您可以转到Google Play控制台->版本管理->应用签名来查看生成的指纹

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM