How to start developing app for Google Glass? - android

I am working on a Google glass Android app. I have installed the glass development kit (GDK) in Android SDK. Now I created a glass project using Android Studio (Version 3.3.2). The newly created project is showing an error "Default Activity not found" in run->edit configuration.
Please refer the screenshot for the error.
1.
And 2. By clicking run->Edit Configuration in menu.
I have searched a lot on Google and found many articles regarding the same. All are suggested to set the edit configurations option like below.
Module: app
Package: Deploy default APK
Activity: Launch default Activity
Target Device: USB Device
I did the same, but no one is working for me. After spending the whole day to make it work, I came here. This error is due to the Launcher activity, because there is no launcher activity in Google glass project instead it uses Voice Trigger intent filter. It is similar to wearable apps they also don't have the launcher activity.

Android Studio won't let you use a standard run configuration without specifying a launcher in the manifest.
You could try using the gradle command line instead:
./gradlew installDebug

In case you haven't resolved the issue. I came across similar issue before, two ways worked for me:
Choose "Nothing" as the option. You will be able to run the app manually on the Glass, but your debugger won't work straight away. You have to manually attach the debugger to the process. You may also have to use logcat if there is a bug in the launching process.
Specify an activity (whichever is associated with voice trigger).
Also, I noticed that you created the app using Kotlin. Kotlin activity didn't work in my case, throwing exceptions associated with nullable var when resuming the activity. Non-activity classes worked fine. Please let me know if Kotlin activity worked in your case.

Related

Can't see the code flowing while using chrome://inspect/#devices?

I am working on an app,which I have installed in my Smartphone, I wanted to check the flow of code while running the app.
using Android Studio I installed the app via USB Debugger, and open the app project files in
chrome://inspect/#devices
, while running , I have added multiple breakpoints in the code to see the flow, but the code haven't stopped at any breakpoint, yet there is no issue with the running of app, the app ran smoothly.
I am facing the same issue while using emulator as well.
Can someone help me to figure out, what I could do ?
EDIT -
I have followed #KannanSJD instructions as well, by "Attaching Debugger to Android" and selecting "Java Only" but not got any success. , As you can see in the below attachments
make sure you attach your debugger to your app process. Use the below icon on top left
if your app package and its process is not showing then make sure you are running in Debug mode and not in release mode using build variants.
Make sure your app is open and you see your process as in screenshot.
Also instead of detect automatically you cna use Java only if you have NDK also used in your project. This will fasten the process of attaching debugger.
Also make sure you find the following log in your debug console.
Please check if you have muted your breakpoints, refer following image. That should NOT be enabled.

Hide application shortcut

I am trying to make an application of which I am trying to hide the launcher shortcut. The reason for this is so I could use this apps as a module / extension for another app without it being visible or cluttering the launcher environment (ie. having this app on your phone will unlock partial functionality in another app). I have been looking into how to do this for a while now, but I can't find a proper solution.
I have read a 'solution' to this issue that tells me to remove <category android:name="android.intent.category.LAUNCHER" /> from the AndroidManifest.xml file. This however results in Android Studio not being able to build or run the app at all, giving me an error that says Default Activity not found (I have tried this with a fresh project and an empty activity).
I am trying to develop this app on my personal device which is a Huawei P9 Lite, running android 6.0
Is there a way to do this?
EDIT
I've read somewhere that Google has removed the ability to uninstall shortcuts since android 6.0. Although it doesn't really say anything about hiding shortcuts for your application, I went ahead and assumed it's part of the same security fix.
Is there a way to do this for the newest platform versions?
I have read a 'solution' to this issue that tells me to remove from the AndroidManifest.xml file.
That is the correct answer.
This however results in Android Studio not being able to build or run the app at all, giving me an error that says Default Activity not found (I have tried this with a fresh project and an empty activity).
Well, it may not make sense to run it. After all, you say that this app is a plugin to some other app. In many cases, a plugin itself cannot run independently (e.g., you cannot run a browser plugin except via the hosting browser).
That being said, you can edit your run configuration via Run > Edit Configurations, and choose what you want to have happen when you run the module:
The run configuration for an app module defaults to "Default Activity", but you can choose something else (e.g., "Specific Activity").
I've read somewhere that Google has removed the ability to uninstall shortcuts since android 6.0.
That answer is unrelated to your question.

Custom Keyboard - Could not identify launch activity: Default Activity not found

I am following a tutorial on creating a custom keyboard for an Android device. I am using Android Studio 2.1.2. There is no activity in the program because you have to activate the keyboard in the language & input settings.
When I run the program I get this error: "Could not identify launch activity: Default Activity not found
Error while Launching activity"
I have posted on the site but have gotten no response. I followed the tutorial step by step and looked it over for a couple of days. I am new to Android Studio and Android applications and was wondering if anyone knew how to help me.
This is the link to the site I am following: http://code.tutsplus.com/tutorials/create-a-custom-keyboard-on-android--cms-22615
I just figured out what needed to be done.
You have to edit the configurations and change the launch option to "nothing". This way it won't try to launch and activity that does not exist.
run->edit configurations then look for the launch options
Well you have answered it by yourself.
If you are creating an keyboard application(inputmethod) in android, everytime you compile and run your applcation, it will show a warning that there is no default activity since it's InputMethodService, the service. Even you add activity like some settings activity for your keyboard, it will still show you warnings and it's the normal operation.

How to debug widget applications in Xamarin studio?

I'm experimenting with Simple widget application in Xamarin studio and would like to know how to debug it. Trying regular 'Run -> Start Debugging' (F5) produces
Application does not contain a launchable activity
As far as I understand ActivityAttribute.MainLauncher property is designed specifically for this purpose but there is no activity to apply it to in the example I'm playing with.
p.s.
Is there something similar to 'Attach to process' feature?
It seems that there is still no simple solution other than embedding your widget into a self created activity just for the debugging purposes. The last post from the Xamarin team I've found is here.
I've tried a few approaches with an empty activity and trying to trick the debugger - but failed.

Example NetworkUsage Android Code Crashes On Startup?

I am trying to run the example application in the networkusage.zip file on the Android Developers website (location: http://developer.android.com/training/basics/network-ops/index.html).
I have not made any changes to the code whatsoever. However, it crashes immediately on startup. I have tried setting a breakpoint in the onCreate method of the main activity, but it never gets there....just crashes right away.
I am just starting with Android, but I been able to complete other training sessions and run other example apps, so I believe my configuration works. I am running Windows 7, with Eclipse Juno and the very latest JDK and Android SDK/ADT (both downloaded about a week ago).
I am using an emulator targeting Android 4.1 (API 16).
The emulator shows a messages that says Unfortunately, NetWork Usage has stopped working.
Any help would be greatly appreciated!!
In AndroidManifest.xml file, for this project, substitute absolute android:name for NetworkActivity with relative one.
In other words, change this line:
android:name="com.example.networkusage.NetworkActivity"
to look like this:
android:name=".NetworkActivity"
The problem was that NetworkActivity is not in com.example.networkusage (as was in AndroidManifest.xml file), but in com.example.android.networkusage package. Thus, Android couldn't find the class on runtime.

Categories

Resources