I added OneSignal to App and it works fine, but when I added:
com.google.android.gms:play-services-ads:17.1.1
build fails: Cannot fit requested classes in a single dex file (# methods: 70355 > 65536)
I searched then found this https://stackoverflow.com/a/51088321 which indicates the reason.
When I delete play-services-ads
this problem gone.
I didn't get which group or module should I exclude to solve this, I tried this but not solved the problem:
implementation ('com.google.android.gms:play-services-ads:17.1.1'){
transitive = true
exclude group: "play-services-ads-identifier"
exclude group: "play-services-basement"
exclude group: "play-services-measurement-sdk-api"
exclude module: "play-services-measurement-base"
}
gradlew :app:dependencies
related output:
| +--- com.google.android.gms:play-services-ads-base:[17.1.1] -> 17.1.1
| +--- com.google.android.gms:play-services-ads-identifier:16.0.0 (*)
| +--- com.google.android.gms:play-services-ads-lite:[17.1.1] -> 17.1.1
| | +--- com.google.android.gms:play-services-ads-base:[17.1.1] -> 17.1.1
| | +--- com.google.android.gms:play-services-basement:16.0.1 -> 16.1.0 (*)
| | \--- com.google.android.gms:play-services-measurement-sdk-api:16.0.3
| | +--- com.google.android.gms:play-services-basement:16.0.1 -> 16.1.0 (*)
| | \--- com.google.android.gms:play-services-measurement-base:[16.0.4] -> 16.0.4 (*)
| +--- com.google.android.gms:play-services-basement:16.0.1 -> 16.1.0 (*)
| +--- com.google.android.gms:play-services-gass:[17.1.1] -> 17.1.1
| | +--- com.google.android.gms:play-services-ads-base:[17.1.1] -> 17.1.1
| | \--- com.google.android.gms:play-services-basement:16.0.1 -> 16.1.0 (*)
I useed 17.1.1 because minAPI is 15.
I don't want use multidex support, because this is a not a solution.