Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8279481
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T09:21:39+00:00 2026-06-08T09:21:39+00:00

I’m coding my first app targeting ICS (4.0.3 – level 15). I get Action

  • 0

I’m coding my first app targeting ICS (4.0.3 – level 15). I get Action Bars and I think they’re great. But I’m trying fragments for the first time, and I’m still not sure if I like ’em or not. The app I’m currently working on doesn’t need fragments since it has pretty undynamic on screen requirements. Standard activities are working fine. The big However is that I have to use PreferenceActivity with PreferencFragment and Headers. The old form of the activity straight to the preference definition xml file has been depreciated. So I learned to use preference fragments for the preferences display by force of Google. (By the way, has anybody figured out how to skip displaying headers. I used two for a learning experience. One pointing to a single fragment class would have been sufficient. But it looks bad to have to double select with only one header…)

I have been using the emulator thing until about 3 days ago and everything was working. When I moved testing to the device, I could get the preferences screen that displayed the headers (PreferenceActivity class). But, when I selected a header (which calls the PreferencesFragment class), I received the “sorry your app stopped’ message. Back on the emulator, everything worked correctly. It finally dawned on me that I was using Proguard when I generate my APK. Since all the views were driven by standard activities except for my Settings activity most everything worked. When I turned off Proguard, everything worked including Settings. In my Crittercism crash report, the error generated when Proguard is on is class not found. The class not found is the inline PreferenceFragment class.

For instance, using the header

android:fragment="com.mycompany.projectname.FragmentPreferences$SettingsFragment" 

the inline class SettingsFragment is not found by the Android OS running on the device.

Turn off Proguard and reinstall the APK and the above header works fine. With or without Proguard, the PreferenceActivity class FragmentPreferences is always found and the headers display. It fails when selecting a displayed header (invokation of SettingsFragment)…

I tried -dontoptimize and -dontshrink, but my app still wont work with Proguard on. My Proguard settings are standard; i.e., generated when I create a new app using the Eclipse wizard (ADT R20 – latest and greatest). Here are the settings I’m trying to run with:

In project-properties:

proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt

target=Google Inc.:Google APIs:15

In proguard-project:

-keepattributes SourceFile, LineNumberTable

-dontshrink

-dontoptimize

All standard activities (no fragments) work fine with the basic settings. The -dont’s were added in an attempt to limit Proguard to obfuscation only. Settings still blowup when the inline fragment class is called.

Currently I’m generating the APK with Proguard turned off. When I’m ready to go production, I would like to turn it back on.

(BTW, I moved the PreferenceFragment classes to external classes and they still don’t work when Proguard is invoked.)

I’ve entered more than enough stuff here and still haven’t asked my question. Okay, I’ll shut this down with the question:

Does anybody know the correct Proguard settings required to make shared preference fragment classes visible? And if this problem extends to regular fragment use, what are those settings?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T09:21:40+00:00Added an answer on June 8, 2026 at 9:21 am

    I would use -keep class your.package.goes.here.** { *; }, to make sure ProGuard does not get rid of any of your own classes, including your fragments referenced by layouts or other resources instead of code.

    Note that I am no ProGuard expert, and so this may be “swatting a fly with a Buick”, but it works for me, including my PreferenceFragments.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We're building an app, our first using Rails 3, and we're having to build
I am using Paperclip to handle profile photo uploads in my app. They upload
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I need to clean up various Word 'smart' characters in user input, including but
Seemingly simple, but I cannot find anything relevant on the web. What is the
I want to construct a data frame in an Rcpp function, but when I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.