0

My android app was built with Gradle 7.2 with compile SDK version of 32. Recently I updated to Gradle 8.0.1 with compile SDK version of 34. Now the app is working fine in Adroid-12 devices but in Android-13 devices it stuck!. Help?

build.gradle(app)

android {
    compileSdk 34

    defaultConfig {
        applicationId "com.iqnext.irlearner"
        minSdk 26
        targetSdk 34
        versionCode 1
        versionName "1.2.0.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_11
        targetCompatibility JavaVersion.VERSION_11
    }
    namespace 'com.iqnext.irlearner'
}

build.gradle(project)

plugins {
    id 'com.android.application' version '8.1.0' apply false
    id 'com.android.library' version '8.1.0' apply false
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

Manifest.xml

<application
        android:allowBackup="true"
        android:dataExtractionRules="@xml/data_extraction_rules"
        android:fullBackupContent="@xml/backup_rules"
        android:icon="@mipmap/ic_launcher_round"
        android:label="@string/app_name"
        android:networkSecurityConfig="@xml/network_security_config"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/Theme.Material3.DayNight.NoActionBar"
        android:requestLegacyExternalStorage="true"
        android:enableOnBackInvokedCallback="true">
        <activity
           ...Activities
        </activity>
    </application>

LoginActivity.java

 protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mLayout = findViewById(R.id.main_layout);
    progress = new ProgressDialog(this);
    progress.dismiss();
    progress.cancel();
    setContentView(R.layout.activity_login);
    loginBtn=findViewById(R.id.login);
    user = findViewById(R.id.username);
    pass = findViewById(R.id.password);
    url = findViewById(R.id.url);
    getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
    InputMethodManager im = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
    im.showSoftInput(user, 0);
    loginBtn.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            UserLogin userLogin= new UserLogin(user.getText().toString().trim(), pass.getText().toString().trim());
            RetrofitClient apiClient = new RetrofitClient();
            Retrofit retrofit = apiClient.getClient(getApplicationContext());
            Api apiInterface = retrofit.create(Api.class);
            progress.setTitle("Loading");
            progress.setMessage("Logging You In...");
            progress.setCancelable(false); // disable dismiss by tapping outside of the dialog
            progress.show();
            Call<IQnextResponse<LoginResponse>> call = apiInterface.loginToServer(userLogin);
            call.enqueue(new Callback<IQnextResponse<LoginResponse>> () {
                @Override
                public void onResponse(Call<IQnextResponse<LoginResponse>>  call, Response<IQnextResponse<LoginResponse>>  response) {
                    if(response.isSuccessful() && response.body() != null) {
                        if(response.body().getSuccess() != null && response.body().getSuccess().getData() != null) {
                            int returnCode = response.body().getSuccess().getReturnCode();
                            if(returnCode==222){
                                String msg = response.body().getSuccess().getData().getToken();
                                navigateToDashboard(response, userLogin.getUsername());
                            }
                            else if(returnCode==223){
                                //TODO: Navigate to OTP Screen
                                String msg = response.body().getSuccess().getData().getToken();
                                navigateToOTP(response, userLogin);
                            }
                        } else {
                            if(response.body().getError() != null && response.body().getError().getMessage() != null) {
                                Log.d("LOGIN_FAILED",response.body().getError().getMessage());
                                Toast.makeText(getApplicationContext(), response.body().getError().getMessage(), Toast.LENGTH_LONG).show();

                            }
                        }
                    }
                    progress.dismiss();
                    progress.cancel();
                }
                @Override
                public void onFailure(Call<IQnextResponse<LoginResponse>>  call, Throwable t) {
                    Toast.makeText(getApplicationContext(), "Something Went Wrong", Toast.LENGTH_LONG).show();
                    progress.dismiss();
                    progress.cancel();
                }
            });
        }
    });

    url.isClickable();
    url.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            configureURL();
        }
    });

    askPermission();
}

And above is the buisness logic for login.

0x4E43
  • 1
  • 2
  • `but in Android-13 devices it stuck` Stuck? Please explain what happens. We cannot see what you are doing. – blackapps Aug 18 '23 at 08:47
  • It has one Simple login form. while giving the credential touchs are not working. Example, I clicked to enter my username, at that time keyboard is not opening up. Same for buttons. Sometimes it works after 15-20 clicks, But the same app working fine on Android 12 devices. – 0x4E43 Aug 18 '23 at 09:15
  • Post the code . – blackapps Aug 18 '23 at 14:37
  • @blackapps plz have a look on the business logic. – 0x4E43 Aug 21 '23 at 05:29

0 Answers0