-1

I'm posting my question for the second time since I didn't got any positive response last time.

I'm trying to compile an .apk from source code at API level 28 (compileSdkVersion 28). The app apk compiles fine but the app crashes after installing the apk (so I don't have any error log). My app has Admob Ads in the UI itself on various pages.

Here's my project-level build.gradle -

buildscript {
    repositories {
        jcenter()
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.4.1'
        classpath 'com.google.gms:google-services:4.2.0'
    }

Here's my app-level build.gradle -

android {
    useLibrary 'org.apache.http.legacy'
    compileSdkVersion 28

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

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.google.android.gms:play-services-ads:17.2.1'
    implementation 'com.android.support:customtabs:27.0.2'
    implementation 'com.google.android.gms:play-services-maps:+'
    implementation 'com.google.code.gson:gson:2.8.0'
    implementation 'com.github.bumptech.glide:glide:3.7.0'
    implementation 'com.squareup.okhttp3:okhttp:3.9.1'
}
apply plugin: 'com.google.gms.google-services'

Here's the Ad code from my AndroidManifest.xml -

<application>
    <meta-data
        android:name="com.google.android.gms.ads.APPLICATION_ID"
        android:value="*****ADMOB-ID*****"/>
</application>

Here's the Ad code from my MainActivity.java -

import com.google.android.gms.ads.MobileAds;
public class MainActivity extends Activity {


    private LinearLayout linear1;
    private AdView adview1;
    @Override
    protected void onCreate(Bundle _savedInstanceState) {
         super.onCreate(_savedInstanceState);
         setContentView(R.layout.main);
         initialize(_savedInstanceState);
         initializeLogic();
         MobileAds.initialize(this, "*****ADMOB-ID*****");
    } 

I'm relatively new to Android coding.

halfer
  • 19,824
  • 17
  • 99
  • 186
pinaka87
  • 27
  • 1
  • When you say "it crashes after installing", capture and [edit your post](https://stackoverflow.com/posts/56503830/edit) with the full output from `adb install foo.apk` Also include where are you installing to: device or emulator, and include OS version. If app crashes after start see: [Unfortunately MyApp has stopped. How can I solve this?](https://stackoverflow.com/q/23353173/295004) – Morrison Chang Jun 08 '19 at 06:03
  • 4
    Possible duplicate of [Compiling errors at API level 28](https://stackoverflow.com/questions/56488051/compiling-erros-at-api-level-28) – halfer Jun 08 '19 at 21:59
  • 1
    This appears to be a self-admitted duplicate - thank you for owning up. – halfer Jun 08 '19 at 21:59
  • The [help] explains what to do if you're not getting answers to your question. Nowhere in that information does it say *post a duplicate*. – Ken White Jun 08 '19 at 23:42
  • Yes I have the same Problem, When I compile with targetSdkVersion 26 the App runs well. But when I change to targetSdkVersion 28 The App crashes after some secounds. When I set debug break points, and step through the code the app crashes one tiime there and at next try on other step. Programming is not fun anymore. – Ingo Dec 10 '19 at 22:50

1 Answers1

0

google crashlytics

its a very helpful tool for analyzing the crash points in your app.

D. PRAKASH
  • 305
  • 1
  • 12