Place Picker 在 alpha 测试中崩溃,但在 android studio 中没有
Place Picker crashes in alpha test but not in android studio
我遇到了一个我真的无法解决的问题!!
我的应用程序在开发环境中完美运行,无论是在 android 工作室模拟器上还是在我用于预测试(荣誉 8)的 phone 上,但在 google play 上创建 alpha 测试后我收到以下错误:
我按下按钮启动 Picker Place,他会自己激活,但片刻后他会关闭,不允许您进入 select 您所在的位置,我从来没有遇到过这个问题开发和在我的 phone 上的个人测试中也在不同的地方使用它,因为它是在我的 phone 上加载的。
老实说,我的 API 密钥已经激活了 1 年多,但由于个人问题我无法继续开发,您认为这会干扰 [=33= 的正确 APK 操作吗? ]?
正在检查 Google API 仪表板,密钥正在工作并处于活动状态。
在这里我报告我的清单和我用来调用我的 Piker 的代码:
清单:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.miapp.miapp">
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme"
android:fullBackupContent="true"
tools:ignore="GoogleAppIndexingWarning">
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="@ApiKey" />
<activity android:name=".Find_Place">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".OkRes_Activity" />
<activity android:name=".PutIn_Activity"/>
<activity android:name=".utilityBOperation" />
</application>
</manifest>
呼叫派克:
placeNameText.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Log.v(TAG, "Find_Place:placeNameText.setOnClickListener: OnCreate : Ho cliccato la mia Text");
//Richiamo il costruttore del mio Piker
Log.v(TAG, "Find_Place:placeNameText.setOnClickListener: Start....... Richiamo il Piker con IntentBuilder....");
IntentBuilder builder = new IntentBuilder();
try {
Intent intent = builder.build(Find_Place.this);
Log.v(TAG, "Find_Place: OnCreate : Builder : Start....... Lancio il mio builder nell'activity....");
startActivityForResult(intent, PLACE_PICKER_REQUEST);
Toast.makeText(getApplicationContext(), "Sto chiamando il piker ed attendendo il risultato", Toast.LENGTH_LONG).show();
} catch (GooglePlayServicesRepairableException | GooglePlayServicesNotAvailableException e) {
e.printStackTrace();
String message;
message = e.getMessage();
Toast.makeText(getApplicationContext(), message, Toast.LENGTH_LONG).show();
Log.v(TAG, "Find_Place: OnCreate : Builder : C'è stato un errore .... " + e);
}
}
});
我查看结果
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
// Popolo la mia texviView con i miei dati
Toast.makeText(getApplicationContext(),"Sono nel onActivityResult ",Toast.LENGTH_LONG).show();
Log.v(TAG,"Find_Place: OnCreate : onActivityResult : Gestisco il risultato del Piker .... " );
if (requestCode== PLACE_PICKER_REQUEST)
{
Toast.makeText(getApplicationContext(),"Sono nel onActivityResult: requestCode== PLACE_PICKER_REQUEST" + PLACE_PICKER_REQUEST,Toast.LENGTH_LONG).show();
Log.v(TAG, "Find_Place:onActivityResult: Valore del requestCode== PLACE_PICKER_REQUEST " + PLACE_PICKER_REQUEST);
if (resultCode == RESULT_OK) {
Toast.makeText(getApplicationContext(),"Sono nel onActivityResult: resultCode == RESULT_OK",Toast.LENGTH_LONG).show();
Log.v(TAG, "Find_Place:onActivityResult: Valore del resultCode........." + resultCode);
Place place = PlacePicker.getPlace(Find_Place.this, data);
我无法添加错误日志,因为即使从 google 游戏控制台也没有任何崩溃。
如果你能帮助我,我真的不明白问题是什么!
当我在那里时,我添加了这个问题,根据你的说法,这可能会导致问题,我将所有进程都插入到 onActivityResult 中,以便如果未激活选择器,则无法继续?
谢谢大家的帮助
最后我设法自己解决了它并在下面写下解决方案以帮助任何发现相同问题的人。
出现问题的原因是我们创建了一个 api 密钥,我们将要将其插入到我们的代码中,但它仅用作测试密钥。当我们创建 ALPHA 或 BETA 版时,Google Play 控制台会自动生成一个 API 密钥,以与我们在创建过程中生成的 API 密钥一起插入到我们的 GOOGLE 开发人员控制台中应用程序的,这将允许我们使用我们的应用程序开发版本中请求的 API。
重要的
新的API键没有被旧键替换,需要添加,否则在开发环境中将无法再使用API。
希望有用。
我遇到了一个我真的无法解决的问题!! 我的应用程序在开发环境中完美运行,无论是在 android 工作室模拟器上还是在我用于预测试(荣誉 8)的 phone 上,但在 google play 上创建 alpha 测试后我收到以下错误:
我按下按钮启动 Picker Place,他会自己激活,但片刻后他会关闭,不允许您进入 select 您所在的位置,我从来没有遇到过这个问题开发和在我的 phone 上的个人测试中也在不同的地方使用它,因为它是在我的 phone 上加载的。 老实说,我的 API 密钥已经激活了 1 年多,但由于个人问题我无法继续开发,您认为这会干扰 [=33= 的正确 APK 操作吗? ]?
正在检查 Google API 仪表板,密钥正在工作并处于活动状态。
在这里我报告我的清单和我用来调用我的 Piker 的代码:
清单:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.miapp.miapp">
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme"
android:fullBackupContent="true"
tools:ignore="GoogleAppIndexingWarning">
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="@ApiKey" />
<activity android:name=".Find_Place">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".OkRes_Activity" />
<activity android:name=".PutIn_Activity"/>
<activity android:name=".utilityBOperation" />
</application>
</manifest>
呼叫派克:
placeNameText.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Log.v(TAG, "Find_Place:placeNameText.setOnClickListener: OnCreate : Ho cliccato la mia Text");
//Richiamo il costruttore del mio Piker
Log.v(TAG, "Find_Place:placeNameText.setOnClickListener: Start....... Richiamo il Piker con IntentBuilder....");
IntentBuilder builder = new IntentBuilder();
try {
Intent intent = builder.build(Find_Place.this);
Log.v(TAG, "Find_Place: OnCreate : Builder : Start....... Lancio il mio builder nell'activity....");
startActivityForResult(intent, PLACE_PICKER_REQUEST);
Toast.makeText(getApplicationContext(), "Sto chiamando il piker ed attendendo il risultato", Toast.LENGTH_LONG).show();
} catch (GooglePlayServicesRepairableException | GooglePlayServicesNotAvailableException e) {
e.printStackTrace();
String message;
message = e.getMessage();
Toast.makeText(getApplicationContext(), message, Toast.LENGTH_LONG).show();
Log.v(TAG, "Find_Place: OnCreate : Builder : C'è stato un errore .... " + e);
}
}
});
我查看结果
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
// Popolo la mia texviView con i miei dati
Toast.makeText(getApplicationContext(),"Sono nel onActivityResult ",Toast.LENGTH_LONG).show();
Log.v(TAG,"Find_Place: OnCreate : onActivityResult : Gestisco il risultato del Piker .... " );
if (requestCode== PLACE_PICKER_REQUEST)
{
Toast.makeText(getApplicationContext(),"Sono nel onActivityResult: requestCode== PLACE_PICKER_REQUEST" + PLACE_PICKER_REQUEST,Toast.LENGTH_LONG).show();
Log.v(TAG, "Find_Place:onActivityResult: Valore del requestCode== PLACE_PICKER_REQUEST " + PLACE_PICKER_REQUEST);
if (resultCode == RESULT_OK) {
Toast.makeText(getApplicationContext(),"Sono nel onActivityResult: resultCode == RESULT_OK",Toast.LENGTH_LONG).show();
Log.v(TAG, "Find_Place:onActivityResult: Valore del resultCode........." + resultCode);
Place place = PlacePicker.getPlace(Find_Place.this, data);
我无法添加错误日志,因为即使从 google 游戏控制台也没有任何崩溃。 如果你能帮助我,我真的不明白问题是什么! 当我在那里时,我添加了这个问题,根据你的说法,这可能会导致问题,我将所有进程都插入到 onActivityResult 中,以便如果未激活选择器,则无法继续?
谢谢大家的帮助
最后我设法自己解决了它并在下面写下解决方案以帮助任何发现相同问题的人。 出现问题的原因是我们创建了一个 api 密钥,我们将要将其插入到我们的代码中,但它仅用作测试密钥。当我们创建 ALPHA 或 BETA 版时,Google Play 控制台会自动生成一个 API 密钥,以与我们在创建过程中生成的 API 密钥一起插入到我们的 GOOGLE 开发人员控制台中应用程序的,这将允许我们使用我们的应用程序开发版本中请求的 API。 重要的 新的API键没有被旧键替换,需要添加,否则在开发环境中将无法再使用API。
希望有用。