Someone could help me, I made a game in Corona and works perfectly on the simulator, but when I install the Android does not work, the functions are not called. Follow the project https://github.com/AndreRavagnani/SamuraiTheRevenge
Thanks
Make sure you aren't requiring anything in your main.lua file. Also what I would recommend doing is using ADB logcat to see what error is happening on the device. Most likely it's a syntax error that only occurs on build. Plug your android device into your computer and run logcat to see what happens.
If it works on the simulator but not working on your device, then these could be the few possible errors.
Check the file names are proper, because corona is case sensitive, simulator wont care about the spellings but device will throw error.
Check whether you are giving the proper scene name, this also case sensitive.
Check whether you are giving the proper file path .
I hope if you check these things it will give you some solution.
Related
There seem to be too many bugs which have not been properly documented, regarding android studio. I am trying to run a basic Hello world app, and this error is truly making me give up any more efforts.
What I did:
Open Android studio(also tried running as administrator) and tried to run the default Hello world app on an Android 10 device(Xiaomi). At the start it shows Failed to start monitoring 7D8XXCOJGQQCZLJV(device number). At first I ignored it being a beginner and clicked on the run button. The file was successfully built and the RUN section shows 'Install successfully finished'.
Now for clarity here are some screenshots that will display what happened on my android device after the above steps:
The app seemed to be installed correctly, but whenever I click on the app logo the response I get is really frustrating:
As per the this link I tried to go to the device manager and do some changes, by setting and enabling Xiaomi drivers for Portable devices.
But then windows shows:
If anybody knows how to solve this, please do help me in doing so. It is quite discouraging to experience so many errors, right at the beginning. If somebody could give a working solution then that would really help me in continuing my android journey.
There was just a tiny error that led to this entire problem. This was because I had set the value of android:exported="false" in the main activity, which had to be set to true. Hope that this may help anybody in the future!
set the value of android:exported="true" in the AndroidManifest
I'm having a problem where an app I'm developing is working on mobile devices (tested on 4 different devices), but crashing when I try to test it on my tablet. The tablet I'm using is a Tesco Hudl 2, which, although being a good quality low cost device, lacks adb drivers and so you can't debug apps through USB and get the Logcat data. The app was developed using Android Studio.
With other apps I have developed, I have just set up ACRA in the project so I can still get debug information from a crash. This time however, the app is crashing without any information from ACRA and so I'm not quite sure what is going wrong. I'm pretty sure I've set up ACRA correctly given that I've used it in several projects before and see nothing wrong this time. Can it be that whatever is going wrong is happening too early for ACRA to catch?
I have pulled out all the code from the activity so the only thing that happens in code is that ACRA gets initialized in the derived Application class (note that the crash exists without ACRA). The app also uses Google maps and a provider for search suggestions. If there is any code anyone wants to see just ask, but I'm unsure what exactly to post up since everything else was stripped out. So, does anyone have any idea on what I can do to solve this, or what tools I can use to catch whatever sort of errors happen so early in the apps lifecycle?
Thanks
Update with strange behaviour... Downloaded Crashlytics and it also did not catch the crash. I copied the project and removed every .java file except the Application, Activity and provider. The provider functions were empty (save for the return value of 0/false/null/whatever), the application class just initialized Crashlyitcs and the Activity class was empty. This then worked, I was even able to add in a lot of the code and get the google map to load.
Now if I do the same in my main project, except don't delete the .java files, the crash still happens. The classes in these files are not used so I have no idea how they can be causing the crash. Otherwise all the xml, gradle, resources are identical (except the package and app name). Very confusing...
Consider using one of the apps to view logcat on the device:
https://play.google.com/store/apps/details?id=com.nolanlawson.logcat
https://play.google.com/store/apps/details?id=org.jtb.alogcat
Also try using Crashlytics. Maybe it will catch your crash?
But yeah, it's possible to have a crash before any crash reporter (ACRA or Crashlytics) will have a chance to catch it.
And one more note, maybe there is a way to enabled ADB over WiFi.
Normally you would need to enable it via adb but maybe in case of this cheap and strange tablet, there is an option for that enabled in the ROM?
Ok! So it's 1am and I decided to have one final attempt to fix, which I think I did. In my manifest, I had things like
<activity
android:name=".MyActivity"
...
for example, and while this worked fine on the mobiles, for some reason the Hudl required the complete package name, i.e. com.mypackage.MyActivity. Not sure why this is the case but it appears to have fixed the problem.
I'm trying to create a (root) app in /system/app, but having an issue that I can't resolve without seeing some errors and debugging to see exactly where it's going wrong.
If I run from Eclipse, errors are expected however, as the app won't have appropriate permissions.
How can I run a local (/system/app) installation, and somehow see what's going wrong?
Can it be done from Eclipse? I had a look at this - but it's so poorly formatted I couldn't make sense of it. If it can't - is there some way to print errors as text?
if its possible to see what type of run time exception in android mobile? because i developed one application which works fine in emulator but stop working in mobile.. is there any Log-cat..
[a Log-cat]: https://play.google.com/store/apps/details?id=org.jtb.alogcat&hl=en doesn't shows errors..! i cant find any tutorials for "a Log-cat" apk.. please help me!! Thanks in adavance
You will find a lot of applications to read the Log of your installed Apps, but they require root permissions to display the exceptions.
If you have the sdk tools installed you have access to the log cat from that if you run your apk while connected to the computer. If you use eclipse there is even a guy with easy access to it, otherwise there are command line tools.
In essence, plug it into your computer and you can get to the logs.
I would recommend you work through:
https://developer.android.com/training/basics/firstapp/index.html?hl=cn
As it will get you set up and teach you to use the tools. If you don't want to do that:
Command Line:
http://developer.android.com/tools/help/logcat.html
Eclipse:
How to enable LogCat/Console in Eclipse for Android?
How to debug on a real device (using Eclipse/ADT)
IntelliJ
https://www.jetbrains.com/idea/webhelp/debugging-with-logcat.html
Short: Either root and use an application to view the log cat, or plug it into your computer.
you can try this code to view it
try{
//do something
}catch(Exception e){
Toast.makeText(context,e.message(),Toast.LENGTH_LONG).show();
//or you can start a new ACTIVITY and put STACKTRACE in a TextView
}
But this have a drawback that you should know that in which part of you app the Exception may occur.
I have tried it using a Toast. Hope it helps.
any best way to debug exception unless using logcat since the overall code are very big? do u think using break point to view the value if installing apk into actual android phone and running it on the phone via usb cable?
do u think using break point to view the value if installing apk into actual android phone
If this means, 'can you debug using breakpoints on the actual phone?'. The answer is Yes
Here is a tutorial you can follow
The size of the codebase is mostly irrelevant when trying to find the cause of an exception (It might complicate things a little, but in general the procedure is the same as debugging a small application). Debugging is the most efficient way of finding bugs, because you're running directly inside your application and you will not have to speculate about the current state of your application (you can actually look at it).
I suggest that you...
Get familiar with Eclipse debugging
Read the stacktrace
Try to find the exact line in the code where the exception happened (according to the stacktrace)
Set a breakpoint at the exact line or at the beginning of the method
Restart you application and wait until you hit the breakpoint
Inspect the variables using the tools in Eclipse
Hope that helps.