triniwiz / nativescript-image-zoom

Apache License 2.0
19 stars 14 forks source link

Android 11: Expected Android API level 21+ but was 30 #37

Closed sivo1981 closed 3 years ago

sivo1981 commented 3 years ago

√ Getting NativeScript components versions information... √ Component nativescript has 7.1.2 version and is up to date. √ Component @nativescript/core has 7.1.4 version and is up to date. √ Component @nativescript/ios has ^7.1.1 version and is up to date. √ Component @nativescript/android has 7.0.1 version and is up to date.

"@triniwiz/nativescript-image-zoom": "^4.0.0"

System.err: An uncaught Exception occurred on "main" thread.
Calling js method onCreateView failed
Error: java.lang.ExceptionInInitializerError

StackTrace:
createNativeView(file: src\packages\nativescript-image-zoom\index.android.ts:24:74)
    at _setupUI(file: src\packages\core\ui\core\view-base\index.ts:788:21)
    at (file: src\packages\core\ui\core\view-base\index.ts:837:9)
    at eachChildView(file: src\packages\core\ui\content-view\index.ts:77:3)
    at eachChildView(file: src\packages\core\ui\page\page-common.ts:145:8)
    at eachChild(file: src\packages\core\ui\core\view\view-common.ts:868:7)
    at _setupUI(file: src\packages\core\ui\core\view-base\index.ts:836:7)
    at _addViewCore(file: src\packages\core\ui\core\view-base\index.ts:672:8)
    at _addView(file: src\packages\core\ui\core\view-base\index.ts:658:7)
    at onCreateView(file: src\packages\core\ui\frame\index.android.ts:907:9)
    at onCreateView(file: src\packages\core\ui\frame\fragment.android.ts:32:33)
    at com.tns.Runtime.callJSMethodNative(Native Method)
    at com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1302)
    at com.tns.Runtime.callJSMethodImpl(Runtime.java:1188)
    at com.tns.Runtime.callJSMethod(Runtime.java:1175)
    at com.tns.Runtime.callJSMethod(Runtime.java:1153)
    at com.tns.Runtime.callJSMethod(Runtime.java:1149)
    at com.tns.FragmentClass.onCreateView(FragmentClass.java:55)
    at androidx.fragment.app.Fragment.performCreateView(Fragment.java:2699)
    at androidx.fragment.app.FragmentStateManager.createView(FragmentStateManager.java:320)
    at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1199)
    at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1368)
    at androidx.fragment.app.FragmentManager.moveFragmentToExpectedState(FragmentManager.java:1446)
    at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1509)
    at androidx.fragment.app.BackStackRecord.executeOps(BackStackRecord.java:447)
    at androidx.fragment.app.FragmentManager.executeOps(FragmentManager.java:2181)
    at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:2004)
    at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:1959)
    at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:1861)
    at androidx.fragment.app.FragmentManager$4.run(FragmentManager.java:413)
    at android.os.Handler.handleCallback(Handler.java:938)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    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.ExceptionInInitializerError
    at okhttp3.internal.platform.Platform.get(Platform.java:85)
    at okhttp3.OkHttpClient.newSslSocketFactory(OkHttpClient.java:263)
    at okhttp3.OkHttpClient.<init>(OkHttpClient.java:229)
    at okhttp3.OkHttpClient$Builder.build(OkHttpClient.java:1015)
    at com.squareup.picasso.OkHttp3Downloader.<init>(OkHttp3Downloader.java:71)
    at com.squareup.picasso.OkHttp3Downloader.<init>(OkHttp3Downloader.java:50)
    at com.squareup.picasso.OkHttp3Downloader.<init>(OkHttp3Downloader.java:40)
    at com.squareup.picasso.Picasso$Builder.build(Picasso.java:804)
    at com.squareup.picasso.provider.PicassoProvider.get(PicassoProvider.java:34)
    ... 26 more
Caused by: java.lang.IllegalStateException: Expected Android API level 21+ but was 30
    at okhttp3.internal.platform.AndroidPlatform.buildIfSupported(AndroidPlatform.java:238)
    at okhttp3.internal.platform.Platform.findPlatform(Platform.java:202)
    at okhttp3.internal.platform.Platform.<clinit>(Platform.java:79)
    ... 35 more
sivo1981 commented 3 years ago

Adding bellow configuration to App_Resources\Android\app.gradle solves this issue.

dependencies {
  implementation 'com.squareup.okhttp3:okhttp:4.9.0'
}