0

My app crashes at the time of beginning and generates the below error.

The Google Play services resources were not found. Check your project configuration to ensure that the resources are included.

So in order to fix an error I changed the build.gradle(project level) from

    classpath 'com.android.tools.build:gradle:3.1.2'
    classpath 'com.google.gms:google-services:3.0.0'
    classpath 'io.fabric.tools:gradle:1.25.4'`

to

classpath 'com.android.tools.build:gradle:3.1.4'
    classpath 'com.google.gms:google-services:4.1.0'
    classpath 'io.fabric.tools:gradle:1.25.4'

and build.gradle(app level)

implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.google.android.gms:play-services-gcm:11.8.0'
implementation 'com.google.firebase:firebase-core:11.8.0'
implementation 'com.google.firebase:firebase-crash:11.8.0'
implementation 'com.google.firebase:firebase-auth:11.8.0'
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.3'

to

implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.google.android.gms:play-services-gcm:15.0.1'
implementation 'com.google.firebase:firebase-core:16.0.3'
implementation 'com.google.firebase:firebase-crash:11.8.0'
implementation 'com.google.firebase:firebase-auth:11.8.0'
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.5'

After change of above gradle code, my project is running well without the below error.

The Google Play services resources were not found. Check your project configuration to ensure that the resources are included.

But the above gradle changes create another error which is created at runtime when we call activity from one to another which I'm not able to solve, which is as below.

java.lang.NoClassDefFoundError: Failed resolution of: Lcom/..../insta/InstaSplashActivity;

Here, InstaSplashActivity is an activity that will be called from the first activity, which is creating a crash.

Jolta
  • 2,620
  • 1
  • 29
  • 42

3 Answers3

0

Based from documentation, this was thrown:

If the Java Virtual Machine or a ClassLoader instance tries to load in the definition of a class (as part of a normal method call or as part of creating a new instance using the new expression) and no definition of the class could be found.

There are solutions offered from this SO post:

  • Go to "Properties" of the project.
  • Select "Java Build Path"
  • Select "Order and Export" Tab
  • You should see the selected project's "src" and "gen" paths and dependencies here.
  • The order how they listed were first "src" and then "gen" path
  • I switch them, so that "gen" folder is build before the "src"

gen - automated code in project (from dependencies and references)

src - source code in project

or

Try going to Project -> Properties -> Java Build Path -> Order & Export and ensure Android Private Libraries are checked for your project and for all other library projects you are using.

Community
  • 1
  • 1
Jessica Rodriguez
  • 2,899
  • 1
  • 12
  • 27
0

Remove your line

implementation 'com.google.android.gms:play-services-gcm:15.0.1'

Build the project

Add this line

implementation 'com.google.android.gms:play-services:3.2.+'

build again

Also still not work , get add your line through dependency from module setting

Vivek Shah
  • 380
  • 2
  • 8
0

this is fixed by simply uninstalling quick-heal.

quick-heal not permit to run dex files and at the time of running it automatically repair some back-end files of an android studio so, android studio cannot getting files properly so i'm removed quick-heal completely and now my project work well :)