gpt4 book ai didi

java - Android kotlin accountkit - 无法正常工作

转载 作者:太空宇宙 更新时间:2023-11-04 10:10:41 24 4
gpt4 key购买 nike

我已经通过多个教程和示例在 JAVA 和 kotlin 中尝试过它,例如:https://github.com/fbsamples/account-kit-samples-for-android/tree/master/samples/AccountKitSimpleSample我就是无法让它发挥作用!

这是我尝试的最新代码:

fun startRequest(){

val intent = Intent(this, AccountKitActivity::class.java)
val builder = AccountKitConfiguration.AccountKitConfigurationBuilder(LoginType.PHONE, AccountKitActivity.ResponseType.TOKEN)

intent.putExtra(AccountKitActivity.ACCOUNT_KIT_ACTIVITY_CONFIGURATION, builder.build())

startActivityForResult(intent, ACCOUNTKIT_REQUEST_CODE)
Log.d("letsSee", "pikaboo1") // this is shown in the log
}


public override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
Log.d("letsSee", "pikaboo2") // this not
if (requestCode == ACCOUNTKIT_REQUEST_CODE){
val loginResult: AccountKitLoginResult = data!!.getParcelableExtra(AccountKitLoginResult.RESULT_KEY)

if(loginResult.getError() != null)
{
Log.d("letsSee", "error: " + loginResult.getError().toString())
}
else if(loginResult.wasCancelled())
{
Log.d("letsSee", "cancelled")
}
else
{
if(loginResult.getAccessToken() != null){
val accountid = loginResult.getAccessToken()!!.getAccountId()
Log.d("letsSee", "Success: " + accountid.toString())
}else{
Log.d("letsSee", "FAIL: " + loginResult.getAuthorizationCode()!!.substring(0,10))
}
}
}
}

这是错误日志:

09-18 02:00:51.014 1102-1102/com.amoflirt.amoflirt E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.amoflirt.amoflirt, PID: 1102
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/common/api/Api$zzf;
at com.google.android.gms.auth.api.Auth.<clinit>(Unknown Source:0)
at com.facebook.accountkit.ui.AccountKitActivity.onCreate(AccountKitActivity.java:281)
at android.app.Activity.performCreate(Activity.java:7174)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1220)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2910)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3032)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1696)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6944)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.common.api.Api$zzf" on path: DexPathList[[zip file "/data/app/com.amoflirt.amoflirt-wtMOEQEYlPaxtL74SS3EhA==/base.apk", zip file "/data/app/com.amoflirt.amoflirt-wtMOEQEYlPaxtL74SS3EhA==/split_lib_dependencies_apk.apk", zip file "/data/app/com.amoflirt.amoflirt-wtMOEQEYlPaxtL74SS3EhA==/split_lib_resources_apk.apk", zip file "/data/app/com.amoflirt.amoflirt-wtMOEQEYlPaxtL74SS3EhA==/split_lib_slice_0_apk.apk", zip file "/data/app/com.amoflirt.amoflirt-wtMOEQEYlPaxtL74SS3EhA==/split_lib_slice_1_apk.apk", zip file "/data/app/com.amoflirt.amoflirt-wtMOEQEYlPaxtL74SS3EhA==/split_lib_slice_2_apk.apk", zip file "/data/app/com.amoflirt.amoflirt-wtMOEQEYlPaxtL74SS3EhA==/split_lib_slice_3_apk.apk", zip file "/data/app/com.amoflirt.amoflirt-wtMOEQEYlPaxtL74SS3EhA==/split_lib_slice_4_apk.apk", zip file "/data/app/com.amoflirt.amoflirt-wtMOEQEYlPaxtL74SS3EhA==/split_lib_slice_5_apk.apk", zip file "/data/app/com.amoflirt.amoflirt-wtMOEQEYlPaxtL74SS3EhA==/split_lib_slice_6_apk.apk", zip file "/data/app/com.amoflirt.amoflirt-wtMOEQEYlPaxtL74SS3EhA==/split_lib_slice_7_apk.apk", zip file "/data/app/com.amoflirt.amoflirt-wtMOEQEYlPaxtL74SS3EhA==/split_lib_slice_8_apk.apk", zip file "/data/app/com.amoflirt.amoflirt-wtMOEQEYlPaxtL74SS3EhA==/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.amoflirt.amoflirt-wtMOEQEYlPaxtL74SS3EhA==/lib/arm64, /system/lib64, /system/vendor/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:93)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at com.google.android.gms.auth.api.Auth.<clinit>(Unknown Source:0) 
at com.facebook.accountkit.ui.AccountKitActivity.onCreate(AccountKitActivity.java:281) 
at android.app.Activity.performCreate(Activity.java:7174) 
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1220) 
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2910) 
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3032) 
at android.app.ActivityThread.-wrap11(Unknown Source:0) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1696) 
at android.os.Handler.dispatchMessage(Handler.java:105) 
at android.os.Looper.loop(Looper.java:164) 
at android.app.ActivityThread.main(ActivityThread.java:6944) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374) 
Suppressed: java.io.IOException: No original dex files found for dex location (arm64) /data/app/com.amoflirt.amoflirt-wtMOEQEYlPaxtL74SS3EhA==/split_lib_resources_apk.apk
at dalvik.system.DexFile.openDexFileNative(Native Method)
at dalvik.system.DexFile.openDexFile(DexFile.java:353)
at dalvik.system.DexFile.<init>(DexFile.java:100)
at dalvik.system.DexFile.<init>(DexFile.java:74)
at dalvik.system.DexPathList.loadDexFile(DexPathList.java:374)
at dalvik.system.DexPathList.makeDexElements(DexPathList.java:337)
at dalvik.system.DexPathList.<init>(DexPathList.java:157)
at dalvik.system.BaseDexClassLoader.<init>(BaseDexClassLoader.java:65)
at dalvik.system.PathClassLoader.<init>(PathClassLoader.java:64)
at com.android.internal.os.PathClassLoaderFactory.createClassLoader(PathClassLoaderFactory.java:43)
at android.app.ApplicationLoaders.getClassLoader(ApplicationLoaders.java:69)
at android.app.ApplicationLoaders.getClassLoader(ApplicationLoaders.java:36)
at android.app.LoadedApk.createOrUpdateClassLoaderLocked(LoadedApk.java:678)
at android.app.LoadedApk.getClassLoader(LoadedApk.java:711)
at android.app.LoadedApk.getResources(LoadedApk.java:944)
09-18 02:00:51.015 1102-1102/com.amoflirt.amoflirt E/AndroidRuntime: at android.app.ContextImpl.createAppContext(ContextImpl.java:2303)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5943)
at android.app.ActivityThread.-wrap1(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1764)
... 6 more

我对这个可怕的垃圾完全绝望了,已经浪费了两天了

最佳答案

哈利路亚,我明白了:

https://github.com/evollu/react-native-fcm/issues/998

将 googlePlayServicesVersion=12.0.1 添加到 gradle.properties (我想这是不必要的)在 android/build.gradle 中添加了以下内容:

 allprojects {
repositories {
//start here
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == 'com.google.android.gms') {
details.useVersion '12.0.1'
}
if (requested.group == 'com.google.firebase') {
details.useVersion '12.0.1'
}
}
}
//end
jcenter()
maven {
url "https://maven.google.com"
}
}
}

这是我尝试过的第 1000000 次修复,我 99.999% 确信它不会起作用,但它确实起作用了:D

关于java - Android kotlin accountkit - 无法正常工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52377160/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com