react-native-is-screen-captured-ios icon indicating copy to clipboard operation
react-native-is-screen-captured-ios copied to clipboard

error when running app on Android

Open fukemy opened this issue 2 years ago • 5 comments

I saw this log on my app start:

Possible Unhandled Promise Rejection (id: 0):
TypeError: undefined is not a function
TypeError: undefined is not a function
    at ?anon_0_ (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.vedaxlink&modulesOnly=false&runModule=true:285387:73)
    at next (native)
    at asyncGeneratorStep (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.vedaxlink&modulesOnly=false&runModule=true:1277:26)
    at _next (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.vedaxlink&modulesOnly=false&runModule=true:1296:29)
    at anonymous (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.vedaxlink&modulesOnly=false&runModule=true:1301:14)
    at tryCallTwo (/root/react-native/ReactAndroid/hermes-engine/.cxx/Release/2q6r403w/arm64-v8a/lib/InternalBytecode/InternalBytecode.js:61:9)
    at doResolve (/root/react-native/ReactAndroid/hermes-engine/.cxx/Release/2q6r403w/arm64-v8a/lib/InternalBytecode/InternalBytecode.js:216:25)
    at Promise (/root/react-native/ReactAndroid/hermes-engine/.cxx/Release/2q6r403w/arm64-v8a/lib/InternalBytecode/InternalBytecode.js:82:14)
    at anonymous (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.vedaxlink&modulesOnly=false&runModule=true:1293:25)
    at apply (native)
    at _setInitialState (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.vedaxlink&modulesOnly=false&runModule=true:285390:38)
    at apply (native)
    at setInitialState (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.vedaxlink&modulesOnly=false&runModule=true:285383:38)
    at anonymous (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.vedaxlink&modulesOnly=false&runModule=true:285392:22)
    at commitHookEffectListMount (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.vedaxlink&modulesOnly=false&runModule=true:71926:38)
    at commitPassiveMountOnFiber (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.vedaxlink&modulesOnly=false&runModule=true:72952:44)
    at commitPassiveMountEffects_complete (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.vedaxlink&modulesOnly=false&runModule=true:72924:40)
    at commitPassiveMountEffects_begin (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.vedaxlink&modulesOnly=false&runModule=true:72914:47)
    at commitPassiveMountEffects (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.vedaxlink&modulesOnly=false&runModule=true:72904:40)
    at flushPassiveEffectsImpl (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.vedaxlink&modulesOnly=false&runModule=true:74098:34)
    at flushPassiveEffects (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.vedaxlink&modulesOnly=false&runModule=true:74058:43)
    at performSyncWorkOnRoot (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.vedaxlink&modulesOnly=false&runModule=true:73547:28)
    at flushSyncCallbacks (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.vedaxlink&modulesOnly=false&runModule=true:64928:36)
    at flushSyncCallbacksOnlyInLegacyMode (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.vedaxlink&modulesOnly=false&runModule=true:64913:29)
    at batchedUpdates$1 (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.vedaxlink&modulesOnly=false&runModule=true:73587:47)
    at batchedUpdates (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.vedaxlink&modulesOnly=false&runModule=true:62923:36)
    at _receiveRootNodeIDEvent (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.vedaxlink&modulesOnly=false&runModule=true:62991:23)
    at receiveEvent (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.vedaxlink&modulesOnly=false&runModule=true:63014:32)
    at apply (native)
    at __callFunction (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.vedaxlink&modulesOnly=false&runModule=true:4818:36)
    at anonymous (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.vedaxlink&modulesOnly=false&runModule=true:4579:31)
    at __guard (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.vedaxlink&modulesOnly=false&runModule=true:4769:15)
    at callFunctionReturnFlushedQueue (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.vedaxlink&modulesOnly=false&runModule=true:4578:21)

After open the localhost log, navigate to line 285387, I saw this: Screenshot 2023-07-10 at 11 20 09

Can u fixed this?

fukemy avatar Jul 10 '23 04:07 fukemy

I'm using this in an Expo project and after upgrading to Expo SDK 49, I can't build anymore due to this package:

[RUN_GRADLEW] WARNING:The specified Android SDK Build Tools version (29.0.2) is ignored, as it is below the minimum supported version (30.0.3) for Android Gradle Plugin 7.4.2.
[RUN_GRADLEW] Android SDK Build Tools 30.0.3 will be used.
[RUN_GRADLEW] To suppress this warning, remove "buildToolsVersion '29.0.2'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.
[RUN_GRADLEW] FAILURE: Build failed with an exception.
[RUN_GRADLEW] * What went wrong:
[RUN_GRADLEW] Could not determine the dependencies of task ':react-native-is-screen-captured-ios:mergeReleaseGeneratedProguardFiles'.
[RUN_GRADLEW] > Could not determine the dependencies of null.
[RUN_GRADLEW]    > Could not create task ':react-native-is-screen-captured-ios:compileReleaseJavaWithJavac'.
[RUN_GRADLEW]       > In order to compile Java 9+ source, please set compileSdkVersion to 30 or above
[RUN_GRADLEW] * Try:
[RUN_GRADLEW] > Run with --stacktrace option to get the stack trace.
[RUN_GRADLEW] > Run with --info or --debug option to get more log output.
[RUN_GRADLEW] > Run with --scan to get full insights.
[RUN_GRADLEW] * Get more help at https://help.gradle.org
[RUN_GRADLEW] BUILD FAILED in 28s
[RUN_GRADLEW] Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.

Not sure if this is related to your problem as well, but might be...

matallui avatar Jul 11 '23 16:07 matallui

@fukemy this is currently iOS only package. So ye the function is undefined on Android.

Seems for the build https://github.com/dylancom/react-native-is-screen-captured-ios/blob/master/android/build.gradle needs an update. Feel free to submit a PR.

dylancom avatar Jul 11 '23 17:07 dylancom

@matallui, just put those code into react-native.config.js to avoid build on Android

'react-native-is-screen-captured-ios' : {
        platforms: {
          android: null
        }
      }

fukemy avatar Jul 12 '23 02:07 fukemy

@dylancom , I put some condition on index file to check Platform the it's work normally

if(Platform.OS === 'ios'){
    ...do stuff
}

fukemy avatar Jul 12 '23 02:07 fukemy

I'll give that a try when I get a chance. Thanks for the tip!

matallui avatar Jul 12 '23 16:07 matallui