question

farrabal avatar image
farrabal asked

Stuck trying to build SidePanels sample code (Android Studio)

Hi, first of all I must say I'm very new to Android Studio and specially gradle. I'm trying to make a sample project to test SidePanels for the Fire Phone, but I haven't manage to do it, not starting a new project from scratch, nor importing the sample project. I'm using Android Studio 1.0.1 and I followed the getting started guide from https://developer.amazon.com/public/solutions/devices/fire-phone/docs/setup So, as a first step, I created a new android project with a blank activity and I updated the gradle related files. My project build.grade file looks like this: buildscript { repositories { jcenter() } dependencies { classpath 'com.amazon.device.tools.build:gradle:0.12.+' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } allprojects { repositories { jcenter() } } And this is the app specific build.gradle: apply plugin: 'com.android.application' android { compileSdkVersion " Amazon.com:Amazon Fire Phone SDK Addon:17" buildToolsVersion "19.1.0" defaultConfig { applicationId "com.example.dev.sidepaneltest" minSdkVersion 17 targetSdkVersion 17 versionCode 1 versionName "1.0" } buildTypes { release { runProguard false proguardFiles getDefaultProguardFile('proguard-android.txt'), ' proguard-rules.pro' } } } dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) } I didn't touch any of the java or xml files yet, so I'm not using any amazon library yet, just want to use amazon gradle. At this point I'm obtaining this error: Error:The project is using an unsupported version of the Android Gradle plug-in (0.12.2). The recommended version is 1.0.0. Fix plugin version and re-import project As you can see, I can't even compile the simplest project and I'm stuck there. How can I solve this? Thanks in advance.
fire phone
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

farrabal avatar image
farrabal answered
I'm replying to myself here as well: I had to downgrade to Android Studio 0.8.x because the current amazon gradle plugin doesn't work with Android 1.0 (at Dec/2014). So, I built the SidePanel example and prepared it to run in a simulator following https://developer.amazon.com/public/solutions/devices/fire-phone/docs/using-the-api-simulator-tool steps. The app is installed in the device and starts up and shows an UI with no working SidePanel, giving the following error in the logcat: 12-17 14:22:20.743 1120-1120/com.example.amazon.sidepanels E/Trace﹕ error opening trace file: No such file or directory (2) 12-17 14:22:40.323 1120-1120/com.example.amazon.sidepanels E/dalvikvm﹕ Could not find class 'com.amazon.android.metrics.MetricsFactory', referenced from method amazon.util.ActiveMetricsUtil. 12-17 14:22:40.374 1120-1120/com.example.amazon.sidepanels E/AccessibilityHelper﹕ Could not reflect accessibility priority field 12-17 14:22:40.624 1120-1156/com.example.amazon.sidepanels E/ViewVisibilityListenerManager﹕ Could not load specific view visibility manager class amazon.util.ViewVisibilityListenerManagerAdvanced;defaulting to empty implementation java.lang.ClassNotFoundException: amazon.util.ViewVisibilityListenerManagerAdvanced at java.lang.Class.classForName(Native Method) at java.lang.Class.forName(Class.java:217) at java.lang.Class.forName(Class.java:172) at amazon.util.ViewVisibilityListenerManager.getInstance(ViewVisibilityListenerManager.java:62) at amazon.widget.SidePanelLayout$PostInflateInit.run(SidePanelLayout.java:1141) at java.lang.Thread.run(Thread.java:856) Caused by: java.lang.NoClassDefFoundError: amazon/util/ViewVisibilityListenerManagerAdvanced             at java.lang.Class.classForName(Native Method)             at java.lang.Class.forName(Class.java:217)             at java.lang.Class.forName(Class.java:172)             at amazon.util.ViewVisibilityListenerManager.getInstance(ViewVisibilityListenerManager.java:62)             at amazon.widget.SidePanelLayout$PostInflateInit.run(SidePanelLayout.java:1141)             at java.lang.Thread.run(Thread.java:856) Caused by: java.lang.ClassNotFoundException: Didn't find class "amazon.util.ViewVisibilityListenerManagerAdvanced" on path: /data/app/com.example.amazon.sidepanels-1.apk at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:65) at java.lang.ClassLoader.loadClass(ClassLoader.java:501) at java.lang.ClassLoader.loadClass(ClassLoader.java:461)             at java.lang.Class.classForName(Native Method)             at java.lang.Class.forName(Class.java:217)             at java.lang.Class.forName(Class.java:172)             at amazon.util.ViewVisibilityListenerManager.getInstance(ViewVisibilityListenerManager.java:62)             at amazon.widget.SidePanelLayout$PostInflateInit.run(SidePanelLayout.java:1141)             at java.lang.Thread.run(Thread.java:856) 12-17 14:22:41.184 1120-1120/com.example.amazon.sidepanels E/TiltPeekManager﹕ Could not load specific tilt peek manager class amazon.util.AdvancedTiltPeekManager;defaulting to empty implementation java.lang.ClassNotFoundException: amazon.util.AdvancedTiltPeekManager at java.lang.Class.classForName(Native Method) at java.lang.Class.forName(Class.java:217) at java.lang.Class.forName(Class.java:172) at amazon.util.TiltPeekManager.getInstance(TiltPeekManager.java:226) at amazon.widget.SidePanelLayout$TiltPeekListener. (SidePanelLayout.java:3445) at amazon.widget.SidePanelLayout$PostInflateInitUIThread.run(SidePanelLayout.java:1121) at android.os.Handler.handleCallback(Handler.java:725) at android.os.Handler.dispatchMessage(Handler.java:92) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:5041) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:511) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560) at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.NoClassDefFoundError: amazon/util/AdvancedTiltPeekManager             at java.lang.Class.classForName(Native Method)             at java.lang.Class.forName(Class.java:217)             at java.lang.Class.forName(Class.java:172)             at amazon.util.TiltPeekManager.getInstance(TiltPeekManager.java:226)             at amazon.widget.SidePanelLayout$TiltPeekListener. (SidePanelLayout.java:3445)             at amazon.widget.SidePanelLayout$PostInflateInitUIThread.run(SidePanelLayout.java:1121)             at android.os.Handler.handleCallback(Handler.java:725)             at android.os.Handler.dispatchMessage(Handler.java:92)             at android.os.Looper.loop(Looper.java:137)             at android.app.ActivityThread.main(ActivityThread.java:5041)             at java.lang.reflect.Method.invokeNative(Native Method)             at java.lang.reflect.Method.invoke(Method.java:511)             at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)             at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)             at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.ClassNotFoundException: Didn't find class "amazon.util.AdvancedTiltPeekManager" on path: /data/app/com.example.amazon.sidepanels-1.apk at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:65) at java.lang.ClassLoader.loadClass(ClassLoader.java:501) at java.lang.ClassLoader.loadClass(ClassLoader.java:461)             at java.lang.Class.classForName(Native Method)             at java.lang.Class.forName(Class.java:217)             at java.lang.Class.forName(Class.java:172)             at amazon.util.TiltPeekManager.getInstance(TiltPeekManager.java:226)             at amazon.widget.SidePanelLayout$TiltPeekListener. (SidePanelLayout.java:3445)             at amazon.widget.SidePanelLayout$PostInflateInitUIThread.run(SidePanelLayout.java:1121)             at android.os.Handler.handleCallback(Handler.java:725)             at android.os.Handler.dispatchMessage(Handler.java:92)             at android.os.Looper.loop(Looper.java:137)             at android.app.ActivityThread.main(ActivityThread.java:5041)             at java.lang.reflect.Method.invokeNative(Native Method)             at java.lang.reflect.Method.invoke(Method.java:511)             at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)             at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)             at dalvik.system.NativeStart.main(Native Method) At this point I'm lost again. Is any library missing? I've tested the app both in a physical android device (HTC One M7 with Android 4.4.3) and a 4.2.2 stock android virtual device, with similar results. I'm leaving my manifest here in case it helps: thank you.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

DougM@Amazon avatar image
DougM@Amazon answered
Hello farrabal, In order to test the side panels on either your AVD or your physical device, you will need to make sure that the AmazonPlatform.apk file that represents our API simulator tool is installed. Otherwise, you will get the exact error that you describe, being that a library is missing. For more information, please refer to: https://developer.amazon.com/public/solutions/devices/fire-phone/docs/using-the-api-simulator-tool
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.