After ranaming package in android studio from com.example.travelapp to com.company.travelapp i get the error: RuntimeException, NoClassDefFoundError

I’m encountering a NoClassDefFoundError related to androidx.lifecycle.ReportFragment$ActivityInitializationListener in my Android application, resulting in a fatal exception that causes the app to crash immediately upon launch. Here is the full stack trace:

Process: com.company.travelapp, PID: 22365
                         java.lang.RuntimeException: Unable to get provider androidx.startup.InitializationProvider: androidx.startup.StartupException: java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/lifecycle/ReportFragment$ActivityInitializationListener;
                            at android.app.ActivityThread.installProvider(ActivityThread.java:7642)
                            …
                            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1011)
                         Caused by: androidx.startup.StartupException: java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/lifecycle/ReportFragment$ActivityInitializationListener;
                            at androidx.startup.AppInitializer.doInitialize(AppInitializer.java:187)
                            …
                            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1011)
                         Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/lifecycle/ReportFragment$ActivityInitializationListener;
                            at androidx.lifecycle.ProcessLifecycleInitializer.create(ProcessLifecycleInitializer.kt:37)
                            …
                            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1011)
                         Caused by: java.lang.ClassNotFoundException: Didn't find class "androidx.lifecycle.ReportFragment$ActivityInitializationListener" on path: DexPathList[[zip file "/data/app/~~ohF60lMUCczmAb5rmHzgvw==/com.company.travelapp-g88i1O-Z7OUyKk4cvThJVA==/base.apk"],nativeLibraryDirectories=[/data/app/~~ohF60lMUCczmAb5rmHzgvw==/com.company.travelapp-g88i1O-Z7OUyKk4cvThJVA==/lib/arm64, /system/lib64, /system/system_ext/lib64]]
                            at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:207)
                            …
                            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1011)

Steps I’ve Tried

  1. Updated Dependencies: Ensured all lifecycle and startup dependencies are up-to-date in build.gradle.

  2. Cleaned and Rebuilt Project: Performed clean and rebuild steps in Android Studio.

  3. Checked ProGuard Rules: Added rules to keep all necessary classes.

  4. Cleared Gradle Cache: Removed the Gradle cache to resolve any potential corruption issues.

  5. Manually Verified Class: Attempted to verify the presence of the class in the JAR files.

build.gradle (app level) Configuration

dependencies {
    implementation 'androidx.lifecycle:lifecycle-runtime:2.4.0'
    implementation 'androidx.lifecycle:lifecycle-process:2.4.0'
    implementation 'androidx.startup:startup-runtime:1.1.0'
}

android {
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    kotlinOptions {
        jvmTarget = '1.8'
    }
}

ProGuard Rules

-keep class androidx.lifecycle.** { *; }
-keep class androidx.startup.** { *; }

New contributor

James Mbui Gitonga is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật