Yes! I'm seeing the same error! I've set up Game Services for my game to use Leaderboards and wanted to Implement Firebase. I did include the google-services.json file and dependencies on my gradle files. However I'm getting the same error "error: cannot find symbol class R" when trying to make the Build. I already tried doing a "Clean Project", "Rebuild Project", "Sync Project with gradle file" and clearing Caches, but it doesn't help. My Android studio knowledge is limited.
OK. It has been a long time since I have used Android Studio. I quit developing for Google some time ago, but the issue you are referring to I seem to remember running into in the past. Here is what I remember about that Error. First, that error, Can not find symbol class R, can be caused by a whole lot of monsters. So, if you have already tried 1. Clean Project 2. Rebuild Project\Sync Project 3. Invalidate cache (not just clear, invalidate it) Then restart Android Studio and load. If that does not fix it then check your XML files, culprit is many times there. But the easiest fix after doing the above steps 1 through 3 is to now change your min sdk level, if I remember right, Google Play Services require a minimum sdk level great then 7, so set yours to 8. this needs changed in the manifest file and in the build.gradle file. Then rebuild project. Another thing to try is change your latest sdk version, click File then Project Structure. Select "app" , under Properties you can change your Compile SDK version, also there is a parameter called Build Tools Version, sometimes changing that helps as well. Recalling all of this from memory and to be honest I do not recall what version of Android Studio I was even using back then. But hopefully it helps you!
Thank you Codifie for a quick help! I'm still struggling with this error. I did try clean, rebuild, invalidate cache and restarting Android Studio. I have my min SDK version set to 16 (Android 4.1) and target SDK to 26 (Android 8.0) in my App gradle file (It's not necessary to include it anymore in the manifest as far as I know). I've checked my XML files but find nothing suspicious there. I only have the main.xml file and my network_security_config.xml file for Heyzap integration. I hope I can find a solution soon, I'm almost ready to lunch my first game
Ok. Did you check your Build Tools Version? Also, the below line is an example, what does this line say in your build.gradle? dependencies { classpath 'com.android.tools.build:gradle:3.2.1' ...
For my Build Tools Version I'm running 28.0.3 and in my dependencies I have set it to 3.3.1 "com.android.tools.build:gradle:3.3.1"
Also, I do know that downgrading to 3.2.1 for your Gradle Build Tools does some times fix this problem.
I tried using import com.company.game.R; and get an error on Build. "Program type already present: com.google.android.gms.location.places.zza" I'm also using version 3.1.3 for my Gradle Build Tools. This was the version I was using before and I was able to make my game work. Now I cannot get my game working anymore. I'm not even calling the Firebase sdk. I don't know if it has anything to do with updating my Android Studio version.
I've reverted back to Android Studio 3.2 and run things as before. I'm not calling Firebase at all and I get the same error. It appears there's a conflict with how libraries are called. I'm using Heyzap and implementing libraries as follow: Code: implementation 'com.google.android.gms:play-services:12.0.1' implementation 'com.android.support:multidex:1.0.3' implementation fileTree(dir: 'libs', include: ['*.jar']) // Heyzap // implementation 'com.google.android.gms:play-services-ads:11.+' implementation 'com.google.android.gms:play-services-location:11.+' implementation 'com.fyber:fairbid:9.53.0' Whenever I change imports that use the "+" to a specific version I get the error "error: cannot find symbol class R" in my PTServicesBridge.java file: For exampe if I change this: Code: implementation 'com.google.android.gms:play-services-ads:11.+' to this: Code: implementation 'com.google.android.gms:play-services-ads:17.1.3' I'm also getting a warning I wasn't seeing before "Uses unchecked or unsafe operations" on my Cocos2dxReflectionHelper.java file.
Finally got it working! Hope this helps. I'm also using Game Analytics and Heyzap. I'm using "12.+" for Firebase implementation and that seems to be working. Here's my gradle Project setup Code: buildscript { repositories { jcenter() google() } dependencies { classpath 'com.android.tools.build:gradle:3.1.3' // Firebase: google-services plugin classpath 'com.google.gms:google-services:4.2.0' } } allprojects { repositories { jcenter() maven { url "https://maven.google.com" } maven { url "https://fyber.bintray.com/fairbid-maven" } maven { url 'http://maven.gameanalytics.com/release' } } } And here's my gradle Module setup Code: apply plugin: 'com.android.application' android { compileSdkVersion 28 buildToolsVersion "28.0.3" defaultConfig { applicationId "com.company.game" minSdkVersion 16 targetSdkVersion 28 multiDexEnabled true ndk { moduleName "player_shared" } } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' } } dexOptions { javaMaxHeapSize "4g" } } dependencies { implementation 'com.google.android.gms:play-services:12.0.1' implementation 'com.android.support:multidex:1.0.3' implementation fileTree(dir: 'libs', include: ['*.jar']) // Fyber // implementation 'com.google.android.gms:play-services-ads:12.+' implementation 'com.google.android.gms:play-services-location:12.+' implementation 'com.fyber:fairbid:9.53.0' // GameAnalytics // implementation 'com.gameanalytics.sdk:gameanalytics-android:3.4.2' // Firebase implementation 'com.google.firebase:firebase-core:12.+' } // Firebase apply plugin: 'com.google.gms.google-services'
Hmm.. resolved this by removing this line with .R issue: import com.google.android.gms.R from PTServicesBridge.java
Can Anybody provide me a PTServicesBridge.java file because I am getting a lot of error for this section in my buildbox project. For this section I can not give ads in my game. Please provide me the file for buildbox 2 and my version of buildbox is 2.3.3
I need that file PTServicesBridge.java because when I want to monetize my game with appodeal an error occurred the error occurred only and only when I add this line in my defendecy implementation ('com.appodeal.ads:sdk:2.6.3.+') { exclude group: 'com.appodeal.ads.sdk.networks', module: 'smaato' } The error is ( Duplicate class com.google.android.gms.location.places.zza found in modules jetified-play-services-places-12.0.1-runtime.jar (com.google.android.gmslay-services-places:12.0.1) and play-services-places-placereport-16.0.0-runtime.jar (com.google.android.gmslay-services-places-placereport:16.0.0) ) And my defendecy is defendecy{ Implementation 'com.google.android.gmslay-services:12.0.1' implementation 'com.android.support:multidex:1.0.3' implementation fileTree(dir: 'libs', include: ['*.jar']) } For this defencdecy section I can not show ads in my game. When I want modify my defendecy section the error occurred in PTServicesBridge.java. So I need a PTServicesBridge.java file to fix all of it.