ridgerock
Veteran developer
Profile
Posts: 183
Reg: May 19, 2011
Louisville
1,830
08/23/23 02:04 PM (1 year ago)

Error with package R

Hello Has anyone run into the problem where their project is unable to import com.packagename.R? I have done everything I can think of; I have redownloaded the project, cleared cache, invalidated all android studio cache, and tried switching package version. Following new Google standards coming into play I've had to upgrade the gradle to version 8. I know the question remains somewhat vague but that is due to the fact of how little I am able to discern. build.grade (Module)file: apply plugin: 'com.android.application' android { compileSdkVersion 33 defaultConfig { applicationId "com.sainthelens" minSdkVersion 23 targetSdkVersion 33 versionCode 10 versionName "10.0" } compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } dexOptions { javaMaxHeapSize "2048M" } buildTypes { debug { multiDexEnabled true } release { multiDexEnabled true minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } namespace 'com.ascension' } repositories { mavenCentral() jcenter() google() } dependencies { //compile possible .jar files in the libs directory... implementation fileTree(include: ['*.jar'], dir: 'libs') //Google Play Services for Google Cloud Messaging and Google Maps... implementation 'androidx.multidex:multidex:2.0.1' //Firebase for push notifications implementation 'com.google.firebase:firebase-core:21.1.1' implementation 'com.google.firebase:firebase-messaging:23.2.1' implementation 'com.firebase:firebase-jobdispatcher:0.5.2' //SUPPORT implementation 'com.google.android.material:material:1.3.0' implementation 'androidx.legacy:legacy-support-v4:1.0.0' implementation 'androidx.legacy:legacy-support-v13:1.0.0' //OTHER implementation 'com.squareup.picasso:picasso:2.5.2' implementation 'com.google.code.gson:gson:2.8.6' implementation 'com.google.guava:guava:27.0.1-android' //implementation 'com.android.support.constraint:constraint-layout:2.0.4' } //To enable push notifications using Firebase: //1) Download google-services.json file from Firebase control panel //2) Copy google-services.json file into the /app directory of your project //3) Uncomment the following line: apply plugin: 'com.google.gms.google-services' build.gradle (project) file: // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { repositories { jcenter() google() } dependencies { classpath 'com.android.tools.build:gradle:8.1.1' //Dependencies needed for Firebase Mesging: classpath 'com.google.gms:google-services:4.3.15' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } allprojects { repositories { mavenCentral() jcenter() google() } }
 
ridgerock
Veteran developer
Profile
Posts: 183
Reg: May 19, 2011
Louisville
1,830
like
08/24/23 11:49 AM (1 year ago)
Sorry everyone, you can ignore this. I assumed my error was the new google requirements and android studio update causing my problem but in reality I made an incredibly foolish blunder in the gradle file. I can't tell you how many hours I wasted. An admin can delete this post if they want.
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.