我最近在Play商店发布了一个应用程序,由于某种原因,它仅在galaxy s4和s5上崩溃。它适用于所有其他手机,包括其他Galaxy设备。
这是我的onCreate方法。
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
drawer.addDrawerListener(toggle);
toggle.syncState();
// Declare a new thread to do a preference check
Thread t = new Thread(new Runnable() {
@Override
public void run() {
// Initialize SharedPreferences
SharedPreferences getPrefs = PreferenceManager
.getDefaultSharedPreferences(getBaseContext());
// Create a new boolean and preference and set it to true
boolean isFirstStart = getPrefs.getBoolean("firstStart", true);
// If the activity has never started before...
if (isFirstStart) {
// Launch app intro
Intent i = new Intent(MainActivity.this, IntroActivity.class);
startActivity(i);
// Make a new preferences editor
SharedPreferences.Editor e = getPrefs.edit();
// Edit preference to make it false because we don't want this to run again
e.putBoolean("firstStart", false);
// Apply changes
e.apply();
}
}
});
// Start the thread
t.start();
SharedPreferences preferences = getApplicationContext().getSharedPreferences("ids", android.content.Context.MODE_PRIVATE);
Gson gson = new Gson();
String json = preferences.getString("contentIds", null);
Type type = new TypeToken<ArrayList<Integer>>() {}.getType();
contentIds = gson.fromJson(json, type);
if (contentIds != null) {
for(int i : contentIds){
ScrollView x = (ScrollView)findViewById(i);
if (x != null) {
content.add(x);
}
if(x==null){
Log.e("List NULL: ", "LIST NULL");
}
}
}
else{
contentIds = new ArrayList<>();
}
NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
navigationView.setNavigationItemSelectedListener(this);
FragmentManager fragmentManager = getFragmentManager();
fragmentManager.beginTransaction()
.replace(R.id.content_frame, new acid_fragment())
.commit();
fragmentManager.beginTransaction()
.replace(R.id.content_frame, new atomicproperties_frag())
.commit();
fragmentManager.beginTransaction()
.replace(R.id.content_frame, new bonding_fragment())
.commit();
fragmentManager.beginTransaction()
.replace(R.id.content_frame, new complexes_fragment())
.commit();
fragmentManager.beginTransaction()
.replace(R.id.content_frame, new electrochem_fragment())
.commit();
fragmentManager.beginTransaction()
.replace(R.id.content_frame, new equilibrium_fragment())
.commit();
fragmentManager.beginTransaction()
.replace(R.id.content_frame, new gases_fragment())
.commit();
fragmentManager.beginTransaction()
.replace(R.id.content_frame, new kinetics_fragment())
.commit();
fragmentManager.beginTransaction()
.replace(R.id.content_frame, new phases_fragment())
.commit();
fragmentManager.beginTransaction()
.replace(R.id.content_frame, new quantum_fragment())
.commit();
fragmentManager.beginTransaction()
.replace(R.id.content_frame, new solutions_fragment())
.commit();
fragmentManager.beginTransaction()
.replace(R.id.content_frame, new spectroscopy_fragment())
.commit();
fragmentManager.beginTransaction()
.replace(R.id.content_frame, new stoich_fragment())
.commit();
fragmentManager.beginTransaction()
.replace (R.id.content_frame, new thermo_fragment())
.commit();
fragmentManager.beginTransaction()
.replace(R.id.content_frame, new StartScreen())
.commit();
以下是应用崩溃时触发的活动的onCreate方法
super.onCreate(savedInstanceState);
// Instead of fragments, you can also use our default slide
// Just set a title, description, background and image. AppIntro will do the rest.
addSlide(AppIntroFragment.newInstance("Welcome!", "This is an app designed to help AP Chemistry students with helpful notes and quizzes that correspond with the curriculum. We have also included support for Chemistry Olympiad Participants.", R.drawable.ss3, Color.BLACK));
addSlide(AppIntroFragment.newInstance("Key Content", "Tap on a Key Concept to reveal their descriptions. If you find a Key Concept difficult or hard to remember, click on the checkbox next to it, and it will be saved to your home screen for easy access and review.", R.drawable.sskeyconcepts, Color.RED));
addSlide(AppIntroFragment.newInstance("Quizzes", "In the Quiz sections, tap on a question to reveal the answer below it.", R.drawable.ssquiz, Color.BLUE));
addSlide(AppIntroFragment.newInstance("Calculators", "In the Calculator Section, you can solve difficult problems that commonly appear on the AP Test and in practice problems.", R.drawable.sscalculator,Color.MAGENTA));
// OPTIONAL METHODS
// Override bar/separator color.
// setBarColor(Color.parseColor("#3F51B5"));
// setSeparatorColor(Color.parseColor("#2196F3"));
// Hide Skip/Done button.
// showSkipButton(false);
setFadeAnimation();
我得到的错误是在android.graphics.drawable.RippleDrawable
感谢任何帮助。
谢谢!