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

NullPointer when library ties to getCustomView #49

Open
FoamStudio opened this issue Jul 11, 2021 · 6 comments
Open

NullPointer when library ties to getCustomView #49

FoamStudio opened this issue Jul 11, 2021 · 6 comments

Comments

@FoamStudio
Copy link

FoamStudio commented Jul 11, 2021

I've been trying to implement this wonderful library but to no avail. I kept getting the below error log or sometimes get VideoCaptureConfig$Builder not found.

PS: I notice whenever I call InsGallery.openGallery() it open's up an activity which auto rotate to Landscape mode.

My gradle setup

`
implementation 'androidx.appcompat:appcompat:1.3.0'
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'

implementation "com.github.bumptech.glide:glide:4.12.0"
implementation "androidx.camera:camera-camera2:1.0.0"
implementation 'me.jessyan:insgallery:0.7.0'

`

LOGs

2021-07-11 22:46:19.263 18269-18269/com.vrytin.myapplication E/AndroidRuntime: FATAL EXCEPTION: main Process: com.vrytin.myapplication, PID: 18269 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.vrytin.myapplication/com.luck.picture.lib.instagram.PictureSelectorInstagramStyleActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'int com.luck.picture.lib.instagram.InstagramSelectionConfig.getCurrentTheme()' on a null object reference at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3449) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3601) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:85) at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2066) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:223) at android.app.ActivityThread.main(ActivityThread.java:7656) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947) Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'int com.luck.picture.lib.instagram.InstagramSelectionConfig.getCurrentTheme()' on a null object reference at com.luck.picture.lib.instagram.InstagramPreviewContainer.<init>(InstagramPreviewContainer.java:116) at com.luck.picture.lib.instagram.PictureSelectorInstagramStyleActivity.initWidgets(PictureSelectorInstagramStyleActivity.java:204) at com.luck.picture.lib.PictureBaseActivity.onCreate(PictureBaseActivity.java:182) at com.luck.picture.lib.instagram.PictureSelectorInstagramStyleActivity.onCreate(PictureSelectorInstagramStyleActivity.java:124) at android.app.Activity.performCreate(Activity.java:8000) at android.app.Activity.performCreate(Activity.java:7984) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1309) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3422)

@JessYanCoding
Copy link
Owner

Call this method yourself

@FoamStudio
Copy link
Author

InsGallery/picture_library/src/main/java/com/luck/picture/lib/instagram/InsGallery.java

I added InstagramSelectionConfig.createConfig() when calling openGalery() since this will call setInstagramConfig(instagramConfig) indirectly. but still can get it to open the media activity (i.e where I can sleect images or video). Thanks in advance.

InsGallery.openGallery(TalentPostActivity.this, GlideEngine.createGlideEngine(), GlideCacheEngine.createCacheEngine(), mAdapter.getData(), InstagramSelectionConfig.createConfig());

Please see below attached log and gif

Screenshot 2021-07-12 at 15 18 13

device-2021-07-12-152715

@JessYanCoding
Copy link
Owner

#20

@FoamStudio
Copy link
Author

I tried adding camerax_view but kept saying duplicated this

`> Task :app:mergeDebugResources FAILED
/Users/ahyox/.gradle/caches/transforms-2/files-2.1/c00659538d562c1cd70e263a31d1bd34/insgallery-0.7.0/res/values/values.xml:303:4: Duplicate value for resource 'attr/scaleType' with config 'DEFAULT' and product ''. Resource was previously defined here: /Users/ahyox/.gradle/caches/transforms-2/files-2.1/eae24458578416c52df3223e069c3c58/camera-view-1.0.0-alpha26/res/values/values.xml:6:4: .

Execution failed for task ':app:mergeDebugResources'.

A failure occurred while executing com.android.build.gradle.internal.res.ResourceCompilerRunnable
Resource compilation failed. Check logs for details.

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

`

Also tried Multidex all to know avail.

@JessYanCoding
Copy link
Owner

You can use local library

@FoamStudio
Copy link
Author

I did use the local library but got the below error:

Unable to load class 'org.gradle.api.internal.java.usagecontext.LazyConfigurationUsageContext'.
This is an unexpected error. Please file a bug containing the idea.log file.

PS: I was told gradle 6+ doesn't support LazyConfigurationUsageContext . I downgraded to gradle 5.6.4 nothing still work

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