我创建的Android应用程序没有在模拟器中崩溃,也没有在我使用的手机中崩溃,但是在logcat中显示了一些例外,例如java.lang.NoSuchMethodError:但是当我将apk文件传输到其他设备时,80%的用户报告说应用程序在打开应用程序或在应用程序上打开活动时崩溃了。
这让我抓狂,我在不同的模拟器上测试了它,没有一个被撞坏。我只是无法理解问题是什么,请帮助。
我 AndroidMaifest.xml:
compile group: 'com.pi4j', name: 'pi4j-core', version: '1.1'
主要活动:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.androgeekzz.pokemongo_bestguidetipsandtricks">
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".Basics" />
<activity android:name=".Tips" />
<activity android:name=".Tricks" />
<activity android:name=".Bas_What" />
<activity android:name=".Bas_Downld" />
<activity android:name=".Bas_Pikatchu" />
<activity android:name=".Bas_PokeCapture" />
<activity android:name=".Bas_LVI5" />
<activity android:name=".Bas_GainXP_LVL_Up" />
<activity android:name=".Bas_All_Iteams" />
<activity android:name=".Bas_All_Places" />
<activity android:name=".Advanced" />
<activity android:name=".Adv_gainXP" />
<activity android:name=".Adv_1candies" />
<activity android:name=".Adv_2Evolution" />
<activity android:name=".Adv_3PowerUp" />
<activity android:name=".Adv_4FightAGym" />
<activity android:name=".Adv_5DefendGym" />
<activity android:name=".Adv_6LvlGym" />
<activity android:name=".Adv_7Type" />
<activity android:name=".Adv_8Egg" />
<activity android:name=".Tips_0Good" />
<activity android:name=".Tips_1Eevee" />
<activity android:name=".Tips_2EarnXP" />
<activity android:name=".Tips_3Find" />
<activity android:name=".Tips_4Nest" />
<activity android:name=".Adv_Nests" />
<activity android:name=".Resources"></activity>
</application>
LogCat (此日志猫没有崩溃) -
package com.androgeekzz.pokemongo_bestguidetipsandtricks;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.MenuItem;
import android.view.View;
public class MainActivity extends AppCompatActivity {
SharedPreferences prefs;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
prefs = getSharedPreferences("myPrefs", MODE_PRIVATE);
int times = prefs.getInt("ok_clicked", 0);
if (times == 0) {
new AlertDialog.Builder(MainActivity.this).setTitle("Hi there user").setMessage("This app version right now is just 1.0 the later versions will be released soon with even more content,Images and in app video tutorials etc..and this app is completely ADD free so please do consider rating it. ").setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
prefs = getSharedPreferences("myPrefs", MODE_PRIVATE);
SharedPreferences.Editor editor = prefs.edit();
editor.putInt("ok_clicked", 1);
editor.apply();
}
}).show();
}
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setHomeButtonEnabled(true);
}
public void basicsOnclick(View view) {
Intent i = new Intent(this, Basics.class);
startActivity(i);
}
public void advanceOnclick(View view) {
Intent i = new Intent(this, Advanced.class);
startActivity(i);
}
public void tipsOnclick(View view) {
Intent i = new Intent(this, Tips.class);
startActivity(i);
}
public void tricksOnclick(View view) {
Intent i = new Intent(this, Tricks.class);
startActivity(i);
}
public void resourceLinksOnclick(View view) {
Intent i = new Intent(this, Resources.class);
startActivity(i);
}
public void aboutOnclick(View view) {
new AlertDialog.Builder(MainActivity.this).setTitle("About").setMessage("App Name :Pokemon GO-Guide\nVersion :1.0 \nCreator :Prudhvi").setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
}
}).show();
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
this.finish();
return true;
default:
return super.onOptionsItemSelected(item);
}
}
}