sara brown
sara brown

Reputation: 1067

encodeToString base64 android issue

i want to encode string to binary64 however i found an error and i dont know how to solve this. this is my code that im using.

String text = name1.getText().toString();
    // Sending side
    byte[] data = null;
    try {
        data = text.getBytes("UTF-8");
    } catch (UnsupportedEncodingException e1) {
    e1.printStackTrace();
    }
    String base64 = Base64.encodeToString(data, Base64.DEFAULT);

however, Base64.encodeToString showing error saying require API level 8(current min sdk is 1). but im using android 2.2 and i believe its min sdk is 8. am i right?

than i tried to review the issue and it appear to be like this:

enter image description here

Upvotes: 2

Views: 8269

Answers (2)

dongshengcn
dongshengcn

Reputation: 6504

Try to change your AndroidManifest.xml:

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

Upvotes: 4

NickT
NickT

Reputation: 23873

Have a look at your manifest file, there will be an entry in there like

  android:minSdkVersion="8"

Make sure it's at least 8 It sounds like it's set to 1

Upvotes: 2

Related Questions