0

Alright so I'm having this one problem with an app I'm working on and planning on releasing, but the problem is only occurring on one version of the android SDK (Version 4.1.1 API 16).

Can I restrict JUST android version 4.1.1 API 16 from downloading and running my app?

I know googlePlay has a restrict certain device list, but the problem is occurring because of the OS version, NOT the device, at least it seems that way from debugging...

I also know there's the uses-sdk attributes in the manifest file:

<uses-sdk android:minSdkVersion="integer"
          android:targetSdkVersion="integer"
          android:maxSdkVersion="integer" />

But setting the android:minSdkVersion to 17 will be way to high and not be available to many users, I also put a lot of work into making the app backwards compatible and works fine on pre 3.0 devices, it's just this android version 4.1.1 API 16 that is causing me trouble...

Please help! Thank you!

Edit: This is my current uses-sdk in my apps manifest:

<uses-sdk
    android:minSdkVersion="8"
    android:targetSdkVersion="17" />

Edit with relevant code:

//button listener for the number buttons. Each button will display a number 1 - 10
//upon clicking the button the number that is displayed on the button will be
//added to what is displayed in the textView
//
//mCurrentWorkingText is the current expression that is being added updated.
View.OnClickListener genericNumberButtonListener = new View.OnClickListener() {

    @Override
    public void onClick(View v) {
    //cast the incoming view to a textView so we can get
    //the text the button displays
        TextView textView = (TextView) v;
        String textFromButton = textView.getText().toString();

        if (mCurrentWorkingText.length() == 0) {
            mWorkingTextView.setText(mWorkingTextView.getText()
                    .toString().concat(textFromButton));
            mCurrentWorkingText = textFromButton;
        } else {
                    // if the working TextView isn't zero we need to
                    // append
                    // the
                    // textFromButton to what is already there.
                    mWorkingTextView.setText(mWorkingTextView.getText()
                            .toString().concat(textFromButton));
                    mCurrentWorkingText = mCurrentWorkingText
                            .concat(textFromButton);


        }
    }
};

Edit with log of problem: enter image description here

The string changes almost randomly to a completely random number in the last log statement.

Sakiboy
  • 7,252
  • 7
  • 52
  • 69
  • 1
    How about describing the problem? There is probably a fix. – Simon Jan 13 '14 at 19:19
  • 1
    Agreed with Simon here, there are often times version-specific fixes that can be programatically triggered with `Build.VERSION.SDK_INT`, you'd want to look for this instead of taking the easy way out here ;) – Alex Jan 13 '14 at 19:21
  • A fix would be great but I've tried *almost* everything... Here's the problem: I have a view with custom buttons ranging from 0 - 10 and a textView that displays the buttons text after clicking the specific button. Quite often when clicking the buttons the number that has been inputted and displayed just changes randomly to a completely random different number. Example: TextView displays "1777238" I then click "4" to append it to the textViews string, but the textViews string changes to an almost random number like "533323455". Any help is appreciated! – Sakiboy Jan 13 '14 at 19:27
  • 1
    This sounds very much like your bug and my guess is that the OS version is a red herring. Please post the **relevant** code. I really am finding it hard to imagine an Android OS bug so catastrophic that it causes the symptoms you describe. – Simon Jan 13 '14 at 20:00
  • Updated with the button listener code that appends the number the button is displaying to the textView. – Sakiboy Jan 13 '14 at 20:18
  • I imagine there _could_ be a bug in the "concat" function of a single platform release. Try building your String objects without using that method (just manually concatenate them with + or use StringBuffer/Builder) and see if the problem goes away. – Colin M. Jan 13 '14 at 20:57
  • I just switched to using a StringBuilder. I'm still getting encountering the same problem and it's driving me mad... I'm going to hardcode in the buttons for each number, maybe there's a problem with getting the text from the button?... – Sakiboy Jan 13 '14 at 21:01

2 Answers2

1

You can prevent the app from running.

And no, you cannot prevent the app from downloading when on an API in between minSDKVersion and maxSDKVersion/targetSDKVersion

You can check it like this:

if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.GINGERBREAD &&         android.os.Build.VERSION.SDK_INT <= android.os.Build.VERSION_CODES.HONEYCOMB) {
 
 // For gingerbread but lesser than HONEYCOMB, show a dialog or something and close the app
 finish();

}
Community
  • 1
  • 1
Dheeraj Bhaskar
  • 18,633
  • 9
  • 63
  • 66
0

So the problem I was having was caused by the pageTransformer that I was using. Android 4.1.1 really didn't like it. I don't know why but all I know is that if you're using pageTransformer with custom views and ActionBarSherlock you better be careful when using the pageTransformer to add animation to the page turns.

Sakiboy
  • 7,252
  • 7
  • 52
  • 69