0

I'm trying to send SMS from android application to sim number. sms manager giving me this error.

Error:Execution failed for task ':app:transformClassesWithInstantRunForDebug'. android/telephony/SmsManager : Unsupported major.minor version 52.0

here is my code

 private class MyCLiCkListner implements View.OnClickListener {
        @Override
        public void onClick(View view) {


            String number = "03470000000";
            String sms = "hi Mehdi";

            try {
                SmsManager smsManager = SmsManager.getDefault();
                smsManager.sendTextMessage(number, null, sms, null, null);
                Toast.makeText(getApplicationContext(), "SMS Sent!",
                        Toast.LENGTH_LONG).show();
            } catch (Exception e) {
                Toast.makeText(getApplicationContext(),
                        "SMS faild, please try again later!",
                        Toast.LENGTH_LONG).show();
                e.printStackTrace();
            }
        }
    }

this is my gradle

android {
    compileSdkVersion 24
    buildToolsVersion "23.0.3"

    defaultConfig {
        applicationId "balti.sendsmsonnumber"
        minSdkVersion 16
        targetSdkVersion 24
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:24.1.1'``
}
Jitesh Prajapati
  • 2,533
  • 4
  • 29
  • 51
G Mehdi Balti
  • 154
  • 2
  • 12
  • See here: http://stackoverflow.com/questions/10382929/how-to-fix-java-lang-unsupportedclassversionerror-unsupported-major-minor-versi – Jens Sep 05 '16 at 12:18

1 Answers1

0

try to disable instant run as in the picture below enter image description here

Khalid Taha
  • 3,183
  • 5
  • 27
  • 43