Вход с Амазонкой вылетает при запуске - PullRequest
0 голосов
/ 10 апреля 2019

enter image description here

Мой Android-приложение аварийно завершает работу при запуске на телефоне или в эмуляторе.на основе отладки происходит сбой при запуске кода "requestContext.registerListener (new AuthorizeListener () {"

Я следую инструкциям из ссылки "https://developer.amazon.com/docs/login-with-amazon/use-sdk-android.html"" и копирую пример кода приложения (файл Java, файлы Res), которые входят в Шаг 2.

Не могли бы вы помочь мне с возможной причиной?

Я установил библиотеку login-with-amazon-sdk.jar и добавил ключ API. Но мой код этого не делаетиметь файл хранилища ключей (пример приложения имеет файл «debug.3p.keystore»).

файл манифеста

package = "com.example.xxxx">

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

<application
    android:allowBackup="true"
    android:icon="@drawable/btnlwa_gold_a"
    android:label="@string/app_name"
    android:supportsRtl="true"
    android:theme="@style/AppTheme">
    <activity
        android:name="com.amazon.identity.auth.device.workflow.WorkflowActivity"
        android:allowTaskReparenting="true"
        android:launchMode="singleTask"
        android:theme="@android:style/Theme.NoDisplay">
        <intent-filter>
            <action android:name="android.intent.action.VIEW" />

            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />
            <!-- android:host must use the full package name found in Manifest General Attributes -->
            <data
                android:host="${applicationId}"
                android:scheme="amzn" />
        </intent-filter>
    </activity>
    <activity
        android:name=".MainActivity"
        android:configChanges="keyboard|keyboardHidden|orientation|screenSize">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

    <service android:name="org.eclipse.paho.android.service.MqttService" />

    <activity android:name=".Main2Activity" />
    <activity android:name=".LoginWithAmazonActivity" />
      </application>

logcat:

 04-10 18:17:53.411 955-1082/? E/ActivityManager: checkUser: useridlist=null, currentuser=0
    04-10 18:17:53.411 955-1082/? E/ActivityManager: checkUser: useridlist=null, currentuser=0
    04-10 18:17:53.411 955-1082/? E/ActivityManager: checkUser: useridlist=null, currentuser=0
    04-10 18:17:53.411 955-1082/? E/ActivityManager: checkUser: useridlist=null, currentuser=0
    04-10 18:17:53.431 22942-22942/? E/Zygote: v2
    04-10 18:17:53.431 22942-22942/? E/SELinux: [DEBUG] get_category: variable seinfo: untrusted sensitivity: NULL, cateogry: NULL
    04-10 18:17:54.341 242-585/? E/Vold: Failed to find mounted volume for /storage/extSdCard/Android/data/com.google.android.music/files/
    04-10 18:17:54.361 242-585/? E/Vold: Failed to find mounted volume for /storage/extSdCard/Android/data/com.google.android.music/files/
    04-10 18:17:54.361 242-585/? E/Vold: Failed to find mounted volume for /storage/extSdCard/Android/data/com.google.android.music/files/
    04-10 18:17:54.471 955-1493/? E/PersonaManagerService: inState():  stateMachine is null !!
    04-10 18:17:54.481 955-1493/? E/ActivityManager: checkUser: useridlist=null, currentuser=0
    04-10 18:17:54.481 955-1493/? E/ActivityManager: checkUser: useridlist=null, currentuser=0
    04-10 18:17:54.481 955-1493/? E/ActivityManager: checkUser: useridlist=null, currentuser=0
    04-10 18:17:54.481 955-1493/? E/ActivityManager: checkUser: useridlist=null, currentuser=0
    04-10 18:17:54.491 22987-22987/? E/Zygote: v2
    04-10 18:17:54.491 22987-22987/? E/SELinux: [DEBUG] get_category: variable seinfo: default sensitivity: NULL, cateogry: NULL
    04-10 18:17:54.851 955-955/? E/EnterpriseSharedDevicePolicy: isSharedDeviceEnabled
    04-10 18:17:59.321 955-1264/? E/Watchdog: !@Sync 3309 [04-10 18:17:59.332]
    04-10 18:17:59.571 22942-23038/? E/GmsUtils: Failed to connect to Google API client: ConnectionResult{statusCode=API_UNAVAILABLE, resolution=null, message=null}
    04-10 18:17:59.661 22942-23040/? E/GmsUtils: Failed to connect to Google API client: ConnectionResult{statusCode=API_UNAVAILABLE, resolution=null, message=null}
    04-10 18:18:29.321 955-1264/? E/Watchdog: !@Sync 3310 [04-10 18:18:29.333]
    04-10 18:18:36.741 955-1811/? E/ActivityThread: Failed to find provider info for com.samsung.android.sm
    04-10 18:18:36.741 955-1811/? E/ActivityThread: Failed to find provider info for com.samsung.android.sm
    04-10 18:18:36.741 955-1811/? E/SAMP_SPCMtest: setPackageLockingTimeBySPCM() :-1
    04-10 18:18:36.741 955-1811/? E/ActivityThread: Failed to find provider info for com.samsung.android.sm
    04-10 18:18:36.741 955-1811/? E/SAMP_SPCMtest: setPackageLockingTimeBySPCM() :-1
    04-10 18:18:36.741 955-1811/? E/ActivityThread: Failed to find provider info for com.samsung.android.sm
    04-10 18:18:59.331 955-1264/? E/Watchdog: !@Sync 3311 [04-10 18:18:59.334]
    04-10 18:19:29.331 955-1264/? E/Watchdog: !@Sync 3312 [04-10 18:19:29.334]
    04-10 18:19:36.741 955-1811/? E/ActivityThread: Failed to find provider info for com.samsung.android.sm
    04-10 18:19:36.741 955-1811/? E/ActivityThread: Failed to find provider info for com.samsung.android.sm
    04-10 18:19:36.741 955-1811/? E/SAMP_SPCMtest: setPackageLockingTimeBySPCM() :-1
    04-10 18:19:36.741 955-1811/? E/ActivityThread: Failed to find provider info for com.samsung.android.sm
    04-10 18:19:36.741 955-1811/? E/SAMP_SPCMtest: setPackageLockingTimeBySPCM() :-1
    04-10 18:19:36.741 955-1811/? E/ActivityThread: Failed to find provider info for com.samsung.android.sm
    04-10 18:19:59.321 955-1264/? E/Watchdog: !@Sync 3313 [04-10 18:19:59.335]
    04-10 18:20:29.321 955-1264/? E/Watchdog: !@Sync 3314 [04-10 18:20:29.336]
    04-10 18:20:36.741 955-1811/? E/ActivityThread: Failed to find provider info for com.samsung.android.sm
    04-10 18:20:36.741 955-1811/? E/ActivityThread: Failed to find provider info for com.samsung.android.sm
    04-10 18:20:36.741 955-1811/? E/SAMP_SPCMtest: setPackageLockingTimeBySPCM() :-1
    04-10 18:20:36.741 955-1811/? E/ActivityThread: Failed to find provider info for com.samsung.android.sm
    04-10 18:20:36.741 955-1811/? E/SAMP_SPCMtest: setPackageLockingTimeBySPCM() :-1
    04-10 18:20:36.741 955-1811/? E/ActivityThread: Failed to find provider info for com.samsung.android.sm
    04-10 18:20:59.321 955-1264/? E/Watchdog: !@Sync 3315 [04-10 18:20:59.336]
    04-10 18:21:29.331 955-1264/? E/Watchdog: !@Sync 3316 [04-10 18:21:29.337]
    04-10 18:21:36.751 955-1811/? E/ActivityThread: Failed to find provider info for com.samsung.android.sm
    04-10 18:21:36.751 955-1811/? E/ActivityThread: Failed to find provider info for com.samsung.android.sm
    04-10 18:21:36.751 955-1811/? E/SAMP_SPCMtest: setPackageLockingTimeBySPCM() :-1
    04-10 18:21:36.751 955-1811/? E/ActivityThread: Failed to find provider info for com.samsung.android.sm
    04-10 18:21:36.751 955-1811/? E/SAMP_SPCMtest: setPackageLockingTimeBySPCM() :-1
    04-10 18:21:36.751 955-1811/? E/ActivityThread: Failed to find provider info for com.samsung.android.sm
    04-10 18:21:59.331 955-1264/? E/Watchdog: !@Sync 3317 [04-10 18:21:59.338]
    04-10 18:22:29.331 955-1264/? E/Watchdog: !@Sync 3318 [04-10 18:22:29.338]
    04-10 18:22:36.751 955-1811/? E/ActivityThread: Failed to find provider info for com.samsung.android.sm
    04-10 18:22:36.751 955-1811/? E/ActivityThread: Failed to find provider info for com.samsung.android.sm
    04-10 18:22:36.751 955-1811/? E/SAMP_SPCMtest: setPackageLockingTimeBySPCM() :-1
    04-10 18:22:36.751 955-1811/? E/ActivityThread: Failed to find provider info for com.samsung.android.sm
    04-10 18:22:36.751 955-1811/? E/SAMP_SPCMtest: setPackageLockingTimeBySPCM() :-1
    04-10 18:22:36.751 955-1811/? E/ActivityThread: Failed to find provider info for com.samsung.android.sm
    04-10 18:22:59.331 955-1264/? E/Watchdog: !@Sync 3319 [04-10 18:22:59.339]

новый logcat во время сбоя:

04-10 19:08:25.621 27643-27643/com.example.ayezarnwe.awstesting D/ViewRootImpl: ViewPostImeInputStage ACTION_DOWN
04-10 19:08:25.721 27643-27643/com.example.ayezarnwe.awstesting I/Timeline: Timeline: Activity_launch_request id:com.example.ayezarnwe.awstesting time:102324314
04-10 19:08:25.741 27643-27643/com.example.ayezarnwe.awstesting W/ResourcesManager: getTopLevelResources: null for user  0
04-10 19:08:25.751 27643-27643/com.example.ayezarnwe.awstesting D/PhoneWindow: *FMB* installDecor mIsFloating : false
04-10 19:08:25.751 27643-27643/com.example.ayezarnwe.awstesting D/PhoneWindow: *FMB* installDecor flags : -2139029248
04-10 19:08:25.781 27643-27643/com.example.ayezarnwe.awstesting V/PersistentOfflineMutationManager: Thread:[1]:In Constructor
04-10 19:08:25.781 27643-27643/com.example.ayezarnwe.awstesting V/PersistentOfflineMutationManager: Thread:[1]:Priming the pump - Fetching all the queued mutations from the persistent store
04-10 19:08:25.781 27643-27643/com.example.ayezarnwe.awstesting V/PersistentOfflineMutationManager: Thread:[1]: Fetching all mutation requests from persistent store
04-10 19:08:25.781 27643-27643/com.example.ayezarnwe.awstesting V/PersistentOfflineMutationManager: Thread:[1]:Exiting the constructor. There are [0] mutations in the persistent queue
04-10 19:08:25.781 27643-27643/com.example.ayezarnwe.awstesting V/AppSyncComplexObjectsInterceptor: Thread:[1]: Instantiating Complex Objects Interceptor
04-10 19:08:25.791 27643-27643/com.example.ayezarnwe.awstesting D/DisplayManager: DisplayManager()
04-10 19:08:25.801 27643-27643/com.example.ayezarnwe.awstesting D/PhoneWindow: *FMB* isFloatingMenuEnabled mFloatingMenuBtn : null
04-10 19:08:25.801 27643-27643/com.example.ayezarnwe.awstesting D/PhoneWindow: *FMB* isFloatingMenuEnabled return false
04-10 19:08:25.821 27643-27679/com.example.ayezarnwe.awstesting D/AppSyncOfflineMutationManager: Thread:[34973]: Internet CONNECTED.
04-10 19:08:25.821 27643-27680/com.example.ayezarnwe.awstesting V/QueueUpdateHandler: Thread:[34974]: Got message to take action on the mutation queue.
04-10 19:08:25.821 27643-27680/com.example.ayezarnwe.awstesting V/QueueUpdateHandler: Thread:[34974]: Got message to process next mutation if one exists.
04-10 19:08:25.821 27643-27680/com.example.ayezarnwe.awstesting V/AppSyncOfflineMutationManager: Thread:[34974]:Persistent mutations queue is EMPTY!. Will check inMemory Queue next
04-10 19:08:25.821 27643-27680/com.example.ayezarnwe.awstesting V/AppSyncOfflineMutationManager: Thread:[34974]: In Memory mutations queue was EMPTY!. Nothing to process, exiting
04-10 19:08:25.861 27643-27662/com.example.ayezarnwe.awstesting D/OpenGLRenderer: endAllStagingAnimators on 0xb7f5b538 (RippleDrawable) with handle 0xb7f886d0
04-10 19:08:25.871 27643-27643/com.example.ayezarnwe.awstesting I/Timeline: Timeline: Activity_idle id: android.os.BinderProxy@c64afdf time:102324469
04-10 19:08:26.741 27643-27643/com.example.ayezarnwe.awstesting D/ViewRootImpl: ViewPostImeInputStage ACTION_DOWN
04-10 19:08:26.831 27643-27643/com.example.ayezarnwe.awstesting I/Timeline: Timeline: Activity_launch_request id:com.example.ayezarnwe.awstesting time:102325422
04-10 19:08:26.841 27643-27685/com.example.ayezarnwe.awstesting D/RetryInterceptor: Retry Interceptor called
04-10 19:08:26.841 27643-27685/com.example.ayezarnwe.awstesting D/AppSyncSigV4SignerInterceptor: Signer Interceptor called
04-10 19:08:26.851 27643-27685/com.example.ayezarnwe.awstesting D/AppSyncSigV4SignerInterceptor: Subscriber ID is e71a39f4-7a0e-42fa-991d-e4e74988195b
04-10 19:08:26.851 27643-27643/com.example.ayezarnwe.awstesting W/ResourcesManager: getTopLevelResources: null for user  0
04-10 19:08:26.861 27643-27643/com.example.ayezarnwe.awstesting D/com.amazon.identity.auth.map.device.utils.MAPLog.PII: Extracting verison incremental:<obscured>
04-10 19:08:26.861 27643-27643/com.example.ayezarnwe.awstesting D/com.amazon.identity.auth.map.device.utils.MAPLog.PII: Incremental version '%s' was in invalid format.:<obscured>
04-10 19:08:26.861 27643-27643/com.example.ayezarnwe.awstesting D/com.amazon.identity.auth.device.api.workflow.RequestContext.PII: Created RequestContext b5aedfa2-dd65-4141-8074-3e7c0dfccfe4:<obscured>
04-10 19:08:26.861 27643-27643/com.example.ayezarnwe.awstesting D/com.amazon.identity.auth.device.api.workflow.RequestContext.PII: RequestContext b5aedfa2-dd65-4141-8074-3e7c0dfccfe4: registerListener for of request type com.amazon.identity.auth.device.authorization.request.authorize:<obscured>
04-10 19:08:26.871 27643-27682/com.example.ayezarnwe.awstesting I/Results: [Item{__typename=Todo, id=kk, name=ii, description=pp}, Item{__typename=Todo, id=gg, name=kk, description=pp}, Item{__typename=Todo, id=ppp, name=nn, description=jjj}, Item{__typename=Todo, id=ff, name=uu, description=pp}, Item{__typename=Todo, id=ayezar, name=gatewat infinity, description=heater confort}]
04-10 19:08:26.871 27643-27643/com.example.ayezarnwe.awstesting D/PhoneWindow: *FMB* installDecor mIsFloating : false
04-10 19:08:26.871 27643-27643/com.example.ayezarnwe.awstesting D/PhoneWindow: *FMB* installDecor flags : -2139029248
04-10 19:08:26.891 27643-27643/com.example.ayezarnwe.awstesting D/AndroidRuntime: Shutting down VM
04-10 19:08:26.891 27643-27643/com.example.ayezarnwe.awstesting E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.example.ayezarnwe.awstesting, PID: 27643
    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.ayezarnwe.awstesting/com.example.ayezarnwe.awstesting.LoginWithAmazonActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.view.View.setOnClickListener(android.view.View$OnClickListener)' on a null object reference
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2697)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2771)
        at android.app.ActivityThread.access$900(ActivityThread.java:177)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1432)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:135)
        at android.app.ActivityThread.main(ActivityThread.java:5912)
        at java.lang.reflect.Method.invoke(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:372)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1405)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1200)
     Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.view.View.setOnClickListener(android.view.View$OnClickListener)' on a null object reference
        at com.example.ayezarnwe.awstesting.LoginWithAmazonActivity.initializeUI(LoginWithAmazonActivity.java:176)
        at com.example.ayezarnwe.awstesting.LoginWithAmazonActivity.onCreate(LoginWithAmazonActivity.java:85)
        at android.app.Activity.performCreate(Activity.java:6178)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2650)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2771) 
        at android.app.ActivityThread.access$900(ActivityThread.java:177) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1432) 
        at android.os.Handler.dispatchMessage(Handler.java:102) 
        at android.os.Looper.loop(Looper.java:135) 
        at android.app.ActivityThread.main(ActivityThread.java:5912) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at java.lang.reflect.Method.invoke(Method.java:372) 
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1405) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1200) 
04-10 19:08:27.181 27643-27685/com.example.ayezarnwe.awstesting I/RetryInterceptor: Returning network response: success
04-10 19:08:27.191 27643-27685/com.example.ayezarnwe.awstesting I/Results: [Item{__typename=Todo, id=kk, name=ii, description=pp}, Item{__typename=Todo, id=gg, name=kk, description=pp}, Item{__typename=Todo, id=ppp, name=nn, description=jjj}, Item{__typename=Todo, id=ff, name=uu, description=pp}, Item{__typename=Todo, id=ayezar, name=gatewat infinity, description=heater confort}]
04-10 19:08:29.061 27643-27661/com.example.ayezarnwe.awstesting V/AppSyncOfflineMutationInterceptor: Thread:[34964]: processing Mutations
04-10 19:08:29.061 27643-27661/com.example.ayezarnwe.awstesting V/QueueUpdateHandler: Thread:[34964]: Got message to take action on the mutation queue.
04-10 19:08:29.061 27643-27661/com.example.ayezarnwe.awstesting V/QueueUpdateHandler: Thread:[34964]: Got message to process next mutation if one exists.
04-10 19:08:29.061 27643-27661/com.example.ayezarnwe.awstesting V/AppSyncOfflineMutationManager: Thread:[34964]:Persistent mutations queue is EMPTY!. Will check inMemory Queue next
04-10 19:08:29.061 27643-27661/com.example.ayezarnwe.awstesting V/AppSyncOfflineMutationManager: Thread:[34964]: In Memory mutations queue was EMPTY!. Nothing to process, exiting

извлечение:

 mLoginButton = findViewById(R.id.login_with_amazon);
        mLoginButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                AuthorizationManager.authorize(
                        new AuthorizeRequest.Builder(requestContext)
                                .addScopes(ProfileScope.profile(), ProfileScope.postalCode())

недопустимый сбой приложения Logcat для дружественных приложений:

04-10 20:41:15.121 12587-12587/? E/Zygote: v2
04-10 20:41:15.131 12587-12587/? E/SELinux: [DEBUG] get_category: variable seinfo: default sensitivity: NULL, cateogry: NULL
04-10 20:41:17.611 12587-12587/com.example.ayezarnwe.awstesting E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.example.ayezarnwe.awstesting, PID: 12587
    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.ayezarnwe.awstesting/com.example.ayezarnwe.awstesting.LoginWithAmazonActivity}: java.lang.IllegalArgumentException: Invalid API Key
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2697)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2771)
        at android.app.ActivityThread.access$900(ActivityThread.java:177)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1432)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:135)
        at android.app.ActivityThread.main(ActivityThread.java:5912)
        at java.lang.reflect.Method.invoke(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:372)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1405)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1200)
     Caused by: java.lang.IllegalArgumentException: Invalid API Key
        at com.amazon.identity.auth.device.authorization.InternalAuthManager.<init>(InternalAuthManager.java:58)
        at com.amazon.identity.auth.device.authorization.InternalAuthManager.getInstance(InternalAuthManager.java:47)
        at com.amazon.identity.auth.device.api.authorization.AuthorizationManager.getToken(AuthorizationManager.java:242)
        at com.example.ayezarnwe.awstesting.LoginWithAmazonActivity.onStart(LoginWithAmazonActivity.java:98)
        at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1248)
        at android.app.Activity.performStart(Activity.java:6213)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2660)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2771) 
        at android.app.ActivityThread.access$900(ActivityThread.java:177) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1432) 
        at android.os.Handler.dispatchMessage(Handler.java:102) 
        at android.os.Looper.loop(Looper.java:135) 
        at android.app.ActivityThread.main(ActivityThread.java:5912) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at java.lang.reflect.Method.invoke(Method.java:372) 
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1405) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1200)

...