Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android app crashing on v2.0.6 #9

Open
hrithvik123 opened this issue Jan 6, 2025 · 2 comments
Open

Android app crashing on v2.0.6 #9

hrithvik123 opened this issue Jan 6, 2025 · 2 comments

Comments

@hrithvik123
Copy link

hrithvik123 commented Jan 6, 2025

The android app is crashing on startup. Here's the error:

2025-01-06 01:18:02.537 5908-5908 AndroidRuntime app.iptvweb E FATAL EXCEPTION: main Process: app.iptvweb, PID: 5908 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:8489) at android.app.ActivityThread.installContentProviders(ActivityThread.java:7989) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:7675) at android.app.ActivityThread.-$$Nest$mhandleBindApplication(Unknown Source:0) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2478) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loopOnce(Looper.java:230) at android.os.Looper.loop(Looper.java:319) at android.app.ActivityThread.main(ActivityThread.java:8919) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:578) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1103) Caused by: androidx.startup.StartupException: java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/lifecycle/ReportFragment$ActivityInitializationListener; at androidx.startup.AppInitializer.doInitialize(AppInitializer.java:187) at androidx.startup.AppInitializer.discoverAndInitialize(AppInitializer.java:238) at androidx.startup.AppInitializer.discoverAndInitialize(AppInitializer.java:206) at androidx.startup.InitializationProvider.onCreate(InitializationProvider.java:45) at android.content.ContentProvider.attachInfo(ContentProvider.java:2700) at android.content.ContentProvider.attachInfo(ContentProvider.java:2670) at android.app.ActivityThread.installProvider(ActivityThread.java:8484) at android.app.ActivityThread.installContentProviders(ActivityThread.java:7989)  at android.app.ActivityThread.handleBindApplication(ActivityThread.java:7675)  at android.app.ActivityThread.-$$Nest$mhandleBindApplication(Unknown Source:0)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2478)  at android.os.Handler.dispatchMessage(Handler.java:106)  at android.os.Looper.loopOnce(Looper.java:230)  at android.os.Looper.loop(Looper.java:319)  at android.app.ActivityThread.main(ActivityThread.java:8919)  at java.lang.reflect.Method.invoke(Native Method)  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:578)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1103)  Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/lifecycle/ReportFragment$ActivityInitializationListener; at androidx.lifecycle.ProcessLifecycleInitializer.create(ProcessLifecycleInitializer.kt:37) at androidx.lifecycle.ProcessLifecycleInitializer.create(ProcessLifecycleInitializer.kt:25) at androidx.startup.AppInitializer.doInitialize(AppInitializer.java:180) at androidx.startup.AppInitializer.discoverAndInitialize(AppInitializer.java:238)  at androidx.startup.AppInitializer.discoverAndInitialize(AppInitializer.java:206)  at androidx.startup.InitializationProvider.onCreate(InitializationProvider.java:45)  at android.content.ContentProvider.attachInfo(ContentProvider.java:2700)  at android.content.ContentProvider.attachInfo(ContentProvider.java:2670)  at android.app.ActivityThread.installProvider(ActivityThread.java:8484)  at android.app.ActivityThread.installContentProviders(ActivityThread.java:7989)  at android.app.ActivityThread.handleBindApplication(ActivityThread.java:7675)  at android.app.ActivityThread.-$$Nest$mhandleBindApplication(Unknown Source:0)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2478)  at android.os.Handler.dispatchMessage(Handler.java:106)  at android.os.Looper.loopOnce(Looper.java:230)  at android.os.Looper.loop(Looper.java:319)  at android.app.ActivityThread.main(ActivityThread.java:8919)  at java.lang.reflect.Method.invoke(Native Method)  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:578)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1103)  Caused by: java.lang.ClassNotFoundException: Didn't find class "androidx.lifecycle.ReportFragment$ActivityInitializationListener" on path: DexPathList[[zip file "/data/app/~~EOZUyVOaBDET_cblOWhm6A==/app.iptvweb-7QR_RNLAYRF4YZ1D3CMycg==/base.apk"],nativeLibraryDirectories=[/data/app/~~EOZUyVOaBDET_cblOWhm6A==/app.iptvweb-7QR_RNLAYRF4YZ1D3CMycg==/lib/arm64, /system/lib64, /system_ext/lib64]] at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:259) at java.lang.ClassLoader.loadClass(ClassLoader.java:379) at java.lang.ClassLoader.loadClass(ClassLoader.java:312) at androidx.lifecycle.ProcessLifecycleInitializer.create(ProcessLifecycleInitializer.kt:37)  at androidx.lifecycle.ProcessLifecycleInitializer.create(ProcessLifecycleInitializer.kt:25)  at androidx.startup.AppInitializer.doInitialize(AppInitializer.java:180)  at androidx.startup.AppInitializer.discoverAndInitialize(AppInitializer.java:238)  at androidx.startup.AppInitializer.discoverAndInitialize(AppInitializer.java:206)  at androidx.startup.InitializationProvider.onCreate(InitializationProvider.java:45)  at android.content.ContentProvider.attachInfo(ContentProvider.java:2700)  at android.content.ContentProvider.attachInfo(ContentProvider.java:2670)  at android.app.ActivityThread.installProvider(ActivityThread.java:8484)  at android.app.ActivityThread.installContentProviders(ActivityThread.java:7989)  at android.app.ActivityThread.handleBindApplication(ActivityThread.java:7675)  at android.app.ActivityThread.-$$Nest$mhandleBindApplication(Unknown Source:0)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2478)  at android.os.Handler.dispatchMessage(Handler.java:106)  at android.os.Looper.loopOnce(Looper.java:230)  at android.os.Looper.loop(Looper.java:319)  at android.app.ActivityThread.main(ActivityThread.java:8919)  at java.lang.reflect.Method.invoke(Native Method)  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:578)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1103)  

The code I am using is:

import { MediaPlayer } from "@eduardoroth/media-player";
import { useAuth } from "@providers/AuthProvider";
import { CategoryType } from "@types/index";
import { adMob } from "@utils/capacitorAdMob";
import { forwardRef, useEffect, useImperativeHandle } from "react";

interface NativePlayerProps {
  stream: string | null;
  poster: string;
  type: CategoryType;
  onFinished?: () => Promise<void>;
  onProgress?: (time: number) => Promise<void>;
}

const NativePlayer = forwardRef(
  (
    { stream, poster, type, onFinished, onProgress }: NativePlayerProps,
    ref
  ) => {
    const playerId = "video-player";
    const disposePlayer = () => {
      MediaPlayer.removeAllListeners({ playerId });
      MediaPlayer.removeAll();
    };

    const { isUserPro } = useAuth();

    const initializeNativePlayer = async (seektime?: number) => {
      if (stream) {
        try {
          await MediaPlayer.create({
            url: stream,
            playerId,
            android: {
              enablePiP: true,
              enableBackgroundPlay: true,
              openInFullscreen: true,
              automaticallyEnterPiP: true,
            },
          });

          MediaPlayer.addListener(
            "MediaPlayer:Ready",
            async (_event: { playerId: string }) => {
              if (seektime !== undefined) {
                await MediaPlayer.setCurrentTime({ playerId, time: seektime });
              }

              await MediaPlayer.play({ playerId });
            }
          );

          MediaPlayer.addListener(
            "MediaPlayer:TimeUpdated",
            async (event: { playerId: string; currentTime: number }) => {
              if (event.currentTime && onProgress) {
                await onProgress(event.currentTime);
              }
            }
          );

          MediaPlayer.addListener(
            "MediaPlayer:Ended",
            async (_event: { playerId: string }) => {
              if (onFinished) await onFinished();
            }
          );

          MediaPlayer.addListener(
            "MediaPlayer:Removed",
            async (_event: { playerId: string }) => {
              if (!isUserPro) {
                adMob.interstitial();
              }
            }
          );
        } catch (error) {
          console.error("Error initializing native player:", error);
        }
      }
    };

    useEffect(() => {
      return () => {
        disposePlayer();
      };
    }, [stream, type]);

    useImperativeHandle(ref, () => ({
      initializeNativePlayer,
    }));

    return (
      <>
        <div id="video-player" slot="fixed"></div>
      </>
    );
  }
);
export default NativePlayer;

Thanks for the great work.

@eduardoRoth
Copy link
Owner

@hrithvik123 can you try doing a Clean project and Make project again?

@hrithvik123
Copy link
Author

@eduardoRoth I did. Still the same issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants