William From Detroit
William From Detroit

Reputation: 17

Android R Cannot Be Resolved to Variable - Changing Package Name

I've seen a lot of threads discussing when R cannot be resolved to a variable. I tried the solutions that can be found here: "R cannot be resolved to a variable"?.

None of them worked. I think I have found my problem, but I don't know the fix.

My src package name is seniordesign.mobileapp and the package in gen that contains R.java is com.example.android.BluetoothChat

This seems like it is my problem, how do I rename the package in gen or otherwise point to com.example.android.BluetoothChat in my code?

I am using the latest version of Eclipse and both R.java and BuildConfig.java can be found in my gen folder.

Upvotes: 0

Views: 155

Answers (1)

In manifest.xml also rename the package at the manifest tag

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="old.package.name"
    android:versionCode="1"
    android:versionName="1.0" >

to

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="new.package.name"
    android:versionCode="1"
    android:versionName="1.0" >

Upvotes: 1

Related Questions