I am following the tutorial here
I am just trying to get a feel for Android development and AWS integration. I setup the basic helloworld Android app following this guide. Then went on to add the AWS components in the first link.
When I get to the "Monitor Analytics" section, my project will build but throw an exception at runtime.
The exception is as follows:
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.xx.xxxx.wearables_data_receiver.app/com.xx.xxxx.wearables_data_receiver.feature.MainActivity}: java.lang.RuntimeException: Failed to read awsconfiguration.json please check that it is correctly formed.
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2416)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Caused by: java.lang.RuntimeException: Failed to read awsconfiguration.json please check that it is correctly formed.
at com.amazonaws.mobile.config.AWSConfiguration.readInputJson(AWSConfiguration.java:99)
at com.amazonaws.mobile.config.AWSConfiguration.<init>(AWSConfiguration.java:83)
at com.amazonaws.mobile.config.AWSConfiguration.<init>(AWSConfiguration.java:68)
at com.amazonaws.mobile.config.AWSConfiguration.<init>(AWSConfiguration.java:45)
at com.amazonaws.mobile.client.AWSMobileClient.initialize(AWSMobileClient.java:155)
at com.xx.xxxx.wearables_data_receiver.feature.MainActivity.onCreate(MainActivity.java:51)
at android.app.Activity.performCreate(Activity.java:6237)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Caused by: android.content.res.Resources$NotFoundException: Resource ID #0x0
at android.content.res.Resources.getValue(Resources.java:1351)
at android.content.res.Resources.openRawResource(Resources.java:1265)
at android.content.res.Resources.openRawResource(Resources.java:1241)
at com.amazonaws.mobile.config.AWSConfiguration.readInputJson(AWSConfiguration.java:88)
The line:
at com.xx.xxxx.wearables_data_receiver.feature.MainActivity.onCreate(MainActivity.java:51)
Points to the "AWSMobileClient.getInstance().initialize" call from the tutorial in the first link:
AWSMobileClient.getInstance().initialize(this, new AWSStartupHandler() {
#Override
public void onComplete(AWSStartupResult awsStartupResult) {
System.out.println("AWSMobileClient is instantiated and you are connected to AWS!");
}
}).execute();
I'm not sure what's going on here, I have tried opening up the file permissions, and placing it in a few different directories but to no avail. Any help would be greatly appreciated.
The error is due to missing awsconfiguration.json file.
Caused by: java.lang.RuntimeException: Failed to read awsconfiguration.json please check that it is correctly formed.
Could you make sure that you have the awsconfiguration.json file placed in the res/raw directory and has valid json? If you did the set up using Amplify CLI it should always automatically update the awsconfiguration.json file with required information.
Related
I am trying to make an Android application that reads data from an Excel file added as an asset. But I believe that some Apache POI function won't work. I got the code from https://www.blueappsoftware.com/how-to-read-excel-file-in-android-tutorial/
I am using Android Studio and Java as a programming language. I know that in order to create a workbook using the Apache POI library I need to have an existing (in my case XLSX) Excel file (that I added to as an asset to my application). And I know that the assets folder holds merely zip files of the file I want to read. So I need to 'convert' the xlsx file in my asset folder to a file. Any ideas?
//inside my Onclick function
InputStream in;
AssetManager assetManager=getApplicationContext().getAssets();
in=assetManager.open("cableSizing.xlsx");
POIFSFileSystem myFileSystem = new POIFSFileSystem(in);
//create the workbook
Workbook workbook= WorkbookFactory.create(myFileSystem);
Error stacktrace
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.michel.cablesizing, PID: 19029
java.lang.IllegalStateException: Could not execute method for android:onClick
at android.support.v7.app.AppCompatViewInflater$DeclaredOnClickListener.onClick(AppCompatViewInflater.java:389)
at android.view.View.performClick(View.java:6597)
at android.view.View.performClickInternal(View.java:6574)
at android.view.View.access$3100(View.java:778)
at android.view.View$PerformClick.run(View.java:25885)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6669)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at android.support.v7.app.AppCompatViewInflater$DeclaredOnClickListener.onClick(AppCompatViewInflater.java:384)
at android.view.View.performClick(View.java:6597)
at android.view.View.performClickInternal(View.java:6574)
at android.view.View.access$3100(View.java:778)
at android.view.View$PerformClick.run(View.java:25885)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6669)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Caused by: org.apache.poi.poifs.filesystem.OfficeXmlFileException: The supplied data appears to be in the Office 2007+ XML. You are calling the part of POI that deals with OLE2 Office Documents. You need to call a different part of POI to process this data (eg XSSF instead of HSSF)
at org.apache.poi.poifs.storage.HeaderBlock.<init>(HeaderBlock.java:126)
at org.apache.poi.poifs.storage.HeaderBlock.<init>(HeaderBlock.java:113)
at org.apache.poi.poifs.filesystem.NPOIFSFileSystem.<init>(NPOIFSFileSystem.java:301)
at org.apache.poi.poifs.filesystem.POIFSFileSystem.<init>(POIFSFileSystem.java:81)
at com.example.michel.cablesizing.MainActivity.TakeActionOK(MainActivity.java:40)
at java.lang.reflect.Method.invoke(Native Method)
at android.support.v7.app.AppCompatViewInflater$DeclaredOnClickListener.onClick(AppCompatViewInflater.java:384)
at android.view.View.performClick(View.java:6597)
at android.view.View.performClickInternal(View.java:6574)
at android.view.View.access$3100(View.java:778)
at android.view.View$PerformClick.run(View.java:25885)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6669)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
i noticed that POIFSFileSystem myFileSystem = new POIFSFileSystem(in) supports only .xls files not xlsx. i changed it to .xls and everything worked fine. but anybody knows what works for .xlsx files?
So i use two different emulators for testing my little app. Strangly the Android 6.0 API 23 version recently started to crash when trying to open an activity from the app. I don't remember what I did :(
Here's the error message i get from "RUN". My guess is that has to something with the GUI? The post page on Stackoverflow only let me post so much of the error so i cut out much of it. Maybe this part is important " Caused by: android.content.res.Resources$NotFoundException:" Anyone know what is happening here?
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.dex, PID: 24065
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.dex/com.example.dex.Activity2}: android.view.InflateException: Binary XML file line #517: Binary XML file line #517: Error inflating class ImageButton
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2416)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Caused by: android.view.InflateException: Binary XML file line #517: Binary XML file line #517: Error inflating class ImageButton
at android.view.LayoutInflater.inflate(LayoutInflater.java:539)
at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:782)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:835)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:838)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)
at android.view.LayoutInflater.inflate(LayoutInflater.java:515)
at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
at android.support.v7.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:469)
Caused by: android.content.res.Resources$NotFoundException: Resource ID #0x7f070082
at android.content.res.Resources.getValue(Resources.java:1351)
at
Caused by: android.view.InflateException: Binary XML file line #517: Error inflating class ImageButton
as you expected, the source of your problem is in the last lines. When Android tries to inflate a layout which contains ImageButton, it does not find a resource. If this is on higher API-levels only, you might have a resource which is a subfolder like drawable-v24 only available for defined API-levels. The reason might also be that you are using a parameter or property that was added later.
I am trying to integrate Symmetric-Android 3.10.2 in my Android application. It is showing
java.lang.NoClassDefFoundError:
org.jumpmind.symmetric.io.stage.StagingManager$1
Even the class exists in jarfile
I have upgraded my API level from 22 to 26 after reading article from
https://sourceforge.net/p/symmetricds/discussion/1354726/thread/f965364c00/
but the issue remains
java.lang.NoClassDefFoundError:
org.jumpmind.symmetric.io.stage.StagingManager$1
at org.jumpmind.symmetric.io.stage.StagingManager.(StagingManager.java:288)
at org.jumpmind.symmetric.android.AndroidSymmetricEngine.createStagingManager(AndroidSymmetricEngine.java:108)
at org.jumpmind.symmetric.AbstractSymmetricEngine.init(AbstractSymmetricEngine.java:348)
at org.jumpmind.symmetric.android.AndroidSymmetricEngine.(AndroidSymmetricEngine.java:84)
at org.jumpmind.symmetric.android.SymmetricService.onStartCommand(SymmetricService.java:88)
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:3944)
at android.app.ActivityThread.access$2300(ActivityThread.java:219)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1833)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:6939)
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:1404)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199)
It sounds like your issue may not be related to SymmetricDS, but instead how your classpath is configured in this Android project. There are several solutions in this thread that might help
I am fairly new to Android and the Google cloud. I have written a test app which successfully writes to a firestore database.
I wanted to extend my application by adding a feature to publish to a pubsub topic.
I added the following dependency line to build.gradle:
implementation 'com.google.cloud:google-cloud-pubsub:0.33.0-beta'
Before I even added any new pubsub code, my app builds, runs, and immediately crashes with the following stacktrace:
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.tliv.mytestapp, PID: 27506
java.lang.RuntimeException: Internal error in Firestore (0.6.6-dev).
at com.google.android.gms.internal.zzeux.run(Unknown Source:23)
at android.os.Handler.handleCallback(Handler.java:790)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Caused by: java.util.ServiceConfigurationError: Provider io.grpc.netty.NettyChannelProvider could not be instantiated: java.lang.ClassCastException: class io.grpc.netty.NettyChannelProvider cannot be cast to com.google.android.gms.internal.zzfmw
at com.google.android.gms.internal.zzfmw.zzq(Unknown Source:84)
at com.google.android.gms.internal.zzfmw.zzdcr(Unknown Source:26)
at com.google.android.gms.internal.zzfmw.<clinit>(Unknown Source:12)
at com.google.android.gms.internal.zzfmw.zzdcs(Unknown Source:0)
at com.google.android.gms.internal.zzfmv.zzud(Unknown Source:0)
at com.google.android.gms.internal.zzeti.<init>(Unknown Source:22)
at com.google.android.gms.internal.zzenf.zza(Unknown Source:74)
at com.google.android.gms.internal.zzenh.run(Unknown Source:8)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:457)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
at com.google.android.gms.internal.zzeuu$zza.run(Unknown Source:7)
at java.lang.Thread.run(Thread.java:764)
Caused by: java.lang.ClassCastException: class io.grpc.netty.NettyChannelProvider cannot be cast to com.google.android.gms.internal.zzfmw
at java.lang.Class.asSubclass(Class.java:2469)
at com.google.android.gms.internal.zzfmw.zzq(Unknown Source:2)
at com.google.android.gms.internal.zzfmw.zzdcr(Unknown Source:26)
at com.google.android.gms.internal.zzfmw.<clinit>(Unknown Source:12)
at com.google.android.gms.internal.zzfmw.zzdcs(Unknown Source:0)
at com.google.android.gms.internal.zzfmv.zzud(Unknown Source:0)
at com.google.android.gms.internal.zzeti.<init>(Unknown Source:22)
at com.google.android.gms.internal.zzenf.zza(Unknown Source:74)
at com.google.android.gms.internal.zzenh.run(Unknown Source:8)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:457)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
at com.google.android.gms.internal.zzeuu$zza.run(Unknown Source:7)
at java.lang.Thread.run(Thread.java:764)
I'm not sure where to begin troubleshooting this. As soon as I remove the pubsub dependency, my code builds and runs fine again.
As per the doc, "Google Cloud Java client libraries do not currently support Android".
You may want to use the Google Cloud Pub/Sub API Client Library instead for your project.
I am not sure if this is the right place to ask this question but I can't find help anywhere. I'm trying to get this application to work but I've run into some errors.
Clicking "Open gallery" button immediately crashes whole app with this error:
FATAL EXCEPTION: main
Process: com.niel.galleryphotoapp, PID: 3691
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.niel.galleryphotoapp/com.niel.galleryphotoapp.HomeFragmentActivity}: java.lang.SecurityException: Permission Denial: reading com.android.providers.media.MediaProvider uri content://media/external/images/media from pid=3691, uid=10086 requires android.permission.READ_EXTERNAL_STORAGE, or grantUriPermission()
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2665)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
Caused by: java.lang.SecurityException: Permission Denial: reading com.android.providers.media.MediaProvider uri content://media/external/images/media from pid=3691, uid=10086 requires android.permission.READ_EXTERNAL_STORAGE, or grantUriPermission()
at android.os.Parcel.readException(Parcel.java:1684)
at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:183)
at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:135)
at android.content.ContentProviderProxy.query(ContentProviderNative.java:421)
at android.content.ContentResolver.query(ContentResolver.java:532)
at android.content.ContentResolver.query(ContentResolver.java:474)
at com.niel.galleryphotoapp.DeviceImageManager.getPhoneAlbums(DeviceImageManager.java:34)
at com.niel.galleryphotoapp.HomeFragmentActivity.onCreate(HomeFragmentActivity.java:80)
at android.app.Activity.performCreate(Activity.java:6679)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2618)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
I don't know why it is happening, I checked the manifest and it seems the required permissions are there.
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
I'm using Android Studio 2.3.3 + Nexus 4 API 25 emulator.
Although you have included permissions in your manifest, you also need to request runtime permissions as well. Everything you need to know is here:
https://developer.android.com/training/permissions/requesting.html
As cjnash said, you need to ask for runtime permissions as well. If you need a quick way just to try it, you can go in your device settings and manually give your app the permissions it needs to run.