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

Can't get version 2.2.1 to work from Android Java project #62

Open
AZOM opened this issue Apr 24, 2019 · 5 comments
Open

Can't get version 2.2.1 to work from Android Java project #62

AZOM opened this issue Apr 24, 2019 · 5 comments

Comments

@AZOM
Copy link

AZOM commented Apr 24, 2019

I've upgraded my project to use AndroidX and RxImagePicker 2.2.1, which broke my code:

@Override
public void onPhotoReadyAction(final Sources pickerSource, final int imageTargetId) {
    Log.d(TAG, String.format("onPhotoReadyAction() --> requestImage() for sources: %s and imageTargetId: %d", pickerSource, imageTargetId));
    photoConverterDisposable = RxImagePicker.Companion.with(activity.getSupportFragmentManager()).requestImage(pickerSource)
            .flatMap((Function<Uri, ObservableSource<Base64Wrapper>>) uri -> ImageConverter.uriToBase64(activity, uri))
            .subscribe(base64Wrapper -> {
                Log.i(TAG, "onPhotoReadyAction() --> requestImage() DONE --> setPhoto() for base64Wrapper: " + base64Wrapper);
                setPhoto(imageTargetId, base64Wrapper);
            });
    activeRequests.add(photoConverterDisposable);
}

My code breaks on the line RxImagePicker.with(activity.getSupportFragmentManager()).requestImage(pickerSource)

with the error: "Cannot resolve method 'with(androidx.fragment.app.FragmentManager)"

Please help

@AZOM
Copy link
Author

AZOM commented Apr 24, 2019

Actually I could resolve it by replacing this line (adding the ".Companion"):

photoConverterDisposable = RxImagePicker.Companion.with(activity.getSupportFragmentManager()).requestImage(pickerSource)

@AZOM AZOM closed this as completed Apr 24, 2019
@AZOM
Copy link
Author

AZOM commented Apr 24, 2019

Actually I could resolve the compiling error it by replacing this line (adding the ".Companion"):

photoConverterDisposable = RxImagePicker.Companion.with(activity.getSupportFragmentManager()).requestImage(pickerSource)


But now it causes a runtime error:

2019-04-24 13:17:34.058 24901-24901/com.tracktics.player.debug D/EditProfileActivity: onComplete() --> presenter.onPhotoReadyAction() for CAMERA, imageTargetId: 2131296481
2019-04-24 13:17:34.060 24901-24901/com.tracktics.player.debug D/EditProfileActivityPresenter: onPhotoReadyAction() --> requestImage() for sources: CAMERA and imageTargetId: 2131296481
2019-04-24 13:17:34.114 24901-24901/com.tracktics.player.debug D/AndroidRuntime: Shutting down VM
2019-04-24 13:17:34.121 24901-24901/com.tracktics.player.debug E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.tracktics.player.debug, PID: 24901
    java.lang.NoClassDefFoundError: Failed resolution of: Lkotlin/jvm/internal/Intrinsics;
        at com.mlsdev.rximagepicker.RxImagePicker$Companion.with(Unknown Source:2)
        at com.tracktics.player.presenters.main.EditProfileActivityPresenter.onPhotoReadyAction(EditProfileActivityPresenter.java:282)
        at com.tracktics.player.views.activities.EditProfileActivity.onComplete(EditProfileActivity.java:379)
        at com.tracktics.player.views.fragments.main.SelectImageBottomSheet.onMakePhotoButtonClick(SelectImageBottomSheet.java:80)
        at com.tracktics.player.views.fragments.main.SelectImageBottomSheet_ViewBinding$2.doClick(SelectImageBottomSheet_ViewBinding.java:40)
        at butterknife.internal.DebouncingOnClickListener.onClick(DebouncingOnClickListener.java:18)
        at android.view.View.performClick(View.java:6597)
        at android.view.View.performClickInternal(View.java:6574)
        at android.view.View.access$3100(View.java:778)
        at android.view.View$PerformClick.run(View.java:25885)
        at android.os.Handler.handleCallback(Handler.java:873)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:193)
        at android.app.ActivityThread.main(ActivityThread.java:6718)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
2019-04-24 13:17:34.123 24901-24901/com.tracktics.player.debug E/AndroidRuntime: Caused by: java.lang.ClassNotFoundException: Didn't find class "kotlin.jvm.internal.Intrinsics" on path: DexPathList[[zip file "/data/app/com.tracktics.player.debug-k9MP6eQ5VG5LxZnyjL23Zw==/base.apk", zip file "/data/app/com.tracktics.player.debug-k9MP6eQ5VG5LxZnyjL23Zw==/split_lib_dependencies_apk.apk", zip file "/data/app/com.tracktics.player.debug-k9MP6eQ5VG5LxZnyjL23Zw==/split_lib_resources_apk.apk", zip file "/data/app/com.tracktics.player.debug-k9MP6eQ5VG5LxZnyjL23Zw==/split_lib_slice_0_apk.apk", zip file "/data/app/com.tracktics.player.debug-k9MP6eQ5VG5LxZnyjL23Zw==/split_lib_slice_1_apk.apk", zip file "/data/app/com.tracktics.player.debug-k9MP6eQ5VG5LxZnyjL23Zw==/split_lib_slice_2_apk.apk", zip file "/data/app/com.tracktics.player.debug-k9MP6eQ5VG5LxZnyjL23Zw==/split_lib_slice_3_apk.apk", zip file "/data/app/com.tracktics.player.debug-k9MP6eQ5VG5LxZnyjL23Zw==/split_lib_slice_4_apk.apk", zip file "/data/app/com.tracktics.player.debug-k9MP6eQ5VG5LxZnyjL23Zw==/split_lib_slice_5_apk.apk", zip file "/data/app/com.tracktics.player.debug-k9MP6eQ5VG5LxZnyjL23Zw==/split_lib_slice_6_apk.apk", zip file "/data/app/com.tracktics.player.debug-k9MP6eQ5VG5LxZnyjL23Zw==/split_lib_slice_7_apk.apk", zip file "/data/app/com.tracktics.player.debug-k9MP6eQ5VG5LxZnyjL23Zw==/split_lib_slice_8_apk.apk", zip file "/data/app/com.tracktics.player.debug-k9MP6eQ5VG5LxZnyjL23Zw==/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.tracktics.player.debug-k9MP6eQ5VG5LxZnyjL23Zw==/lib/arm64, /data/app/com.tracktics.player.debug-k9MP6eQ5VG5LxZnyjL23Zw==/base.apk!/lib/arm64-v8a, /data/app/com.tracktics.player.debug-k9MP6eQ5VG5LxZnyjL23Zw==/split_lib_dependencies_apk.apk!/lib/arm64-v8a, /data/app/com.tracktics.player.debug-k9MP6eQ5VG5LxZnyjL23Zw==/split_lib_resources_apk.apk!/lib/arm64-v8a, /data/app/com.tracktics.player.debug-k9MP6eQ5VG5LxZnyjL23Zw==/split_lib_slice_0_apk.apk!/lib/arm64-v8a, /data/app/com.tracktics.player.debug-k9MP6eQ5VG5LxZnyjL23Zw==/split_lib_slice_1_apk.apk!/lib/arm64-v8a, /data/app/com.tracktics.player.debug-k9MP6eQ5VG5LxZnyjL23Zw==/split_lib_slice_2_apk.apk!/lib/arm64-v8a, /data/app/com.tracktics.player.debug-k9MP6eQ5VG5LxZnyjL23Zw==/split_lib_slice_3_apk.apk!/lib/arm64-v8a, /data/app/com.tracktics.player.debug-k9MP6eQ5VG5LxZnyjL23Zw==/split_lib_slice_4_apk.apk!/lib/arm64-v8a, /data/app/com.tracktics.player.debug-k9MP6eQ5VG5LxZnyjL23Zw==/split_lib_slice_5_apk.apk!/lib/arm64-v8a, /data/app/com.tracktics.player.debug-k9MP6eQ5VG5LxZnyjL23Zw==/split_lib_slice_6_apk.apk!/lib/arm64-v8a, /data/app/com.tracktics.player.debug-k9MP6eQ5VG5LxZnyjL23Zw==/split_lib_slice_7_apk.apk!/lib/arm64-v8a, /data/app/com.tracktics.player.debug-k9MP6eQ5VG5LxZnyjL23Zw==/split_lib_slice_8_apk.apk!/lib/arm64-v8a, /data/app/com.tracktics.player.debug-k9MP6eQ5VG5LxZnyjL23Zw==/split_lib_slice_9_apk.apk!/lib/arm64-v8a, /system/lib64, /vendor/lib64]]
        at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
        	... 17 more
    	Suppressed: java.io.IOException: No original dex files found for dex location /data/app/com.tracktics.player.debug-k9MP6eQ5VG5LxZnyjL23Zw==/split_lib_resources_apk.apk
        at dalvik.system.DexFile.openDexFileNative(Native Method)
        at dalvik.system.DexFile.openDexFile(DexFile.java:354)
        at dalvik.system.DexFile.<init>(DexFile.java:101)
        at dalvik.system.DexFile.<init>(DexFile.java:75)
        at dalvik.system.DexPathList.loadDexFile(DexPathList.java:394)
        at dalvik.system.DexPathList.makeDexElements(DexPathList.java:354)
        at dalvik.system.DexPathList.<init>(DexPathList.java:164)
        at dalvik.system.BaseDexClassLoader.<init>(BaseDexClassLoader.java:74)
        at dalvik.system.BaseDexClassLoader.<init>(BaseDexClassLoader.java:65)
        at dalvik.system.PathClassLoader.<init>(PathClassLoader.java:64)
        at com.android.internal.os.ClassLoaderFactory.createClassLoader(ClassLoaderFactory.java:73)
2019-04-24 13:17:34.123 24901-24901/com.tracktics.player.debug E/AndroidRuntime:     at com.android.internal.os.ClassLoaderFactory.createClassLoader(ClassLoaderFactory.java:88)
        at android.app.ApplicationLoaders.getClassLoader(ApplicationLoaders.java:74)
        at android.app.ApplicationLoaders.getClassLoader(ApplicationLoaders.java:40)
        at android.app.LoadedApk.createOrUpdateClassLoaderLocked(LoadedApk.java:727)
        at android.app.LoadedApk.getClassLoader(LoadedApk.java:810)
        at android.app.LoadedApk.getResources(LoadedApk.java:1032)
        at android.app.ContextImpl.createAppContext(ContextImpl.java:2345)
        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5798)
        at android.app.ActivityThread.access$1100(ActivityThread.java:200)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1656)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        		... 5 more

@AZOM AZOM reopened this Apr 24, 2019
@AZOM AZOM changed the title Cannot resolve method 'with(androidx.fragment.app.FragmentManager)' Can't get version 2.2.1 to work from Android Java project Apr 24, 2019
@laurachelaru
Copy link

I have a similar problem after trying to update to 2.2.1. Have you managed to figure something out?

@AZOM
Copy link
Author

AZOM commented Jun 13, 2019

Unfortunately not @laurachelaru - I just switched to another library instead. (https://github.com/ArthurHub/Android-Image-Cropper)

@ronzano
Copy link

ronzano commented Nov 18, 2019

You should include in your gradle file:
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.60'
(or jdk7, depending on your project)

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

3 participants