DebugView no devices available - java

I'm doing some tests on a small app to understand how firebase-analytics works. This is the code for the MainActivity:
public class MainActivity extends AppCompatActivity {
private FirebaseAnalytics mFirebaseAnalytics;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mFirebaseAnalytics = FirebaseAnalytics.getInstance(getApplicationContext());
mFirebaseAnalytics.setAnalyticsCollectionEnabled(true);
mFirebaseAnalytics.setMinimumSessionDuration(10000);
mFirebaseAnalytics.setSessionTimeoutDuration(300);
Bundle bundle = new Bundle();
bundle.putString(FirebaseAnalytics.Param.ITEM_ID,"ID");
bundle.putString(FirebaseAnalytics.Param.ITEM_NAME,"NAME");
bundle.putString(FirebaseAnalytics.Param.CONTENT_TYPE,"image");
mFirebaseAnalytics.logEvent(FirebaseAnalytics.Event.SELECT_CONTENT, bundle);
}
To see if my app send data to Firebase I tryed to use DebugView but it says that there isn't any devices available, i also used the command
adb shell setprop debug.firebase.analytics.app <package_name>
but nothing changed.
If i use these 3 commands
adb shell setprop log.tag.FA VERBOSE
adb shell setprop log.tag.FA-SVC VERBOSE
adb logcat -v time -s FA FA-SVC
i can see that my app is sending some data to firebase, like in this picture
What can i do to enable DebugView and see what my app send to firebase in real time?

Please ensure that the following steps have been followed:
Step 1: Your app is properly configured in the Firebase console to support the Analytics features.
Step 2:
A) If you are simply working with single build variant, the following command is enough:
adb shell setprop debug.firebase.analytics.app [your_app_package_name]
B) But if you are working with multiple build variants with different application IDs which are not the same as the app package name, be sure to execute the following command:
adb shell setprop debug.firebase.analytics.app [your_application_id]
Here, application ID is the app ID of your build variant found in the corresponding gradle file. For example, lets say you have x.gradle and y.gradle for two build variants x and y, and you also have the general build.gradle file. To debug the build variant x with application ID com.abc.x, the command will be:
adb shell setprop debug.firebase.analytics.app com.abc.x
Similarly, to debug the build variant y with application ID com.abc.y, the command will be:
adb shell setprop debug.firebase.analytics.app com.abc.y
This behavior persists until you explicitly disable it by executing the following command:
adb shell setprop debug.firebase.analytics.app .none.

I had the same symptoms as you did. In my case the problem was simply because I forgot to turn on WiFi, so events couldn't be propagated to cloud but were appearing in logcat.

I've spent insane amount of time debugging this, and my conclusion - it is the Firebase instability, because I get events intermittently, and there is no pattern to what makes them appear in that DebugView

You can see your list of devices -> adb devices
and then -> adb shell setprop debug.firebase.analytics.app package_name
after that, in Android Studio, run by Debug

Ok for me.... the reason was because I was having this on my second screen =>
Lessons learnt:
Android Emulators messes up with the ADB and have an impact on firebase debug view.
Don't play games during work... It's 'DIRECTLY' counter productive.

This command will be helpful to see debug view in firebase analytics:
adb shell setprop debug.firebase.analytics.app
One additional note specified in firebase Google support
Note: Before using DebugView, you should ensure that your device time is accurate. A skewed device clock will result in delayed or missing events in your Analytics reports.
You can refere to below link :
https://support.google.com/firebase/answer/7201382?hl=en

My situation may not be relevant but posting for my future sanity if nothing else.
I had created a new project in firebase and also was having the problem where it said the 'Finish the sdk setup' error trying to communicate with my application (which I had just finished renaming the android package-prompting to create a new project in Firebase)
I was trying to get debugging to work to 'kick' it into connecting, but was getting not devices so I knew there was something wrong.
My issue was my google-services.json filed. It had a reference to my old project name in there AS WELL as my new one. So maybe it was getting confused?
Under client, there were two objects with client_info, api_key, etc. I removed the old one, leaving only the newer correct one.
"client": [
{...}, // <-- removed this one
{...}
]

Make sure you haven't disabled Firebase Analytics logging either on Gradle or on your manifest.

Related

Opening app on macOS 11 Big Sur from JavaFX application randomly fails with kLSNoExecutableErr

We have a desktop JavaFX application (well, TornadoFX) that downloads an archive, extracts another app from it and launches this app with macOS open command.
Simplified kotlin code looks like:
ProcessBuilder(listOf("open", "/path/to/app.app", "arg")).start()
This has worked for years on older versions of macOS (10.15 and earlier) but now with macOS 11 Big Sur launching the app sometimes succeeds and sometimes fails.
In the mac Console.app following error can be seen:
OSStatus _LSCopyApplicationNodeFromOpenState(LSOpenState *): Returning kLSNoExecutableErr because node is a directory but we failed to register with error -10814
We extended the logic to check if all the files are really there before launching the app, and the files existed.
There is an assumption that maybe Launch Services database is not updated fast enough.
Following ways of trying to log what might be happening, didn't reveal any errors:
lsappinfo listen +all forever
log stream --debug --predicate 'subsystem == "com.apple.coreservices.launchservices"'
Does anybody have a clue if there is a way to avoid this behavior and to be always able to launch the app?
After a lot of research and debugging, what seem to have worked for us, was to force Launch Services to register the app in its database by executing command like:
/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -f /path/to/app.app
and afterwards we could launch the app.
The idea for such solution was found in this answer.

Different package names to be added in desired capabilities in appium

We have an android app which is composed of two different apps.
Launcher activity is present in 1 project which has a package name
in.foo.android.main.MainActivity
while app package which is shown in uiautomator view is something like
com.abc.android.debug
in desired capabilites I am setting following :
capabilities.setCapability(MobileCapabilityType.APP_PACKAGE ,"com.abc.android.debug");
capabilities.setCapability(MobileCapabilityType.APP_ACTIVITY,"in.foo.android.main.MainActivity");
So getting below error
com.abc.android.debug/in.foo.android.main.MainActivity is not a launchable activity
Here appium is adding package name by default before the main activity.
can someone provide some help here.
First
Go to CMD as admin type adb devices
Make sure that your device already opened the apps that you want
go to cmd and type adb shell dumpsys window | find "mCurrentFocus"
this the exp
Thats command will showing the current activity
Second
Install the APK Info from playstore (idk if you try on the appstore)
https://play.google.com/store/apps/details?id=com.wt.apkinfo&hl=in&gl=US
Open the APK Info
Search your apps s name and click it
You will see this screen
appdetail
Scroll down and check the activities
activities
You will see all of the activity on the apps
existingactivity

Android Studio, unable to access data folder for database file on emulator

Ok, I have searched and searched without any success for someone with a similar question. I am developing an Android app using Android Studio and have started creating my SQLite database. In order to test my creation and upgrade functions I would like to extract my SQLite database and view it's contents.
Instructions online are fairly clear, open up Android Device Monitor, select the device, go to file explorer, and then browse a few levels deep in the data folder to find your .db file. Here is where the trouble starts. I am unable to expand the root level data folder at all. I have found numerous other questions regarding people having the same problem but they are all due to people trying to do it on un-rooted physical devices. I am simply trying to do it on an emulated device. I am certain it is a permissions problem but I'm not sure how to fix it.
Things I've tried:
Verified that my app is listed as a process on the device selected in the device monitor.
Restarted the AVD, Android Studio, and then my entire machine.
Uninstalled my app and reinstalled.
TLDR; can't access data folder in DDMS for emulated device in order to extract SQLite database file.
Same question to me.
When I want to access /data directory via Android Device Monitor, some error have occurred :
08-21 07:32:36.837: W/ls(3101): type=1400 audit(0.0:50): avc: denied { getattr } for path="/default.prop" dev="rootfs" ino=2941 scontext=u:r:shell:s0 tcontext=u:object_r:rootfs:s0 tclass=file permissive=0
08-21 07:32:37.418: W/PlatformStatsUtil(2507): Could not retrieve Usage & Diagnostics setting. Giving up.
This information tells us we don't have permission to access the directory.
Here are what I have done and works for me.
My OS is Window10
Start your ADV & Open Android Device Monitor
cd to /the/path/to/Android/sdk/platform-tools
Open your cmd or openshell here (shift + right click you will see the option)
execute following commands
.
./adb.exe shell
su
chmod -R 777 /data/data/your/package
Now, enjoy your coding.
Run your app in an emulator with API 23 (or lower).
check detailed information in link below,
Android Device Monitor "data" folder is empty

Glide: log each request

Consider the code below:
Glide.with(<your_context>)
.load(<remote_file_url, local_file_path>)
.into(<imageview>);
Above Glide code is written in lots of file.
Simply I want to log my remote_file_url or local_file_path in logcat. But I don't want to change the code in every file.
Is Glide allowing logging? If it allows, then I need a simple central way to turn on glide logging.
For Reference: I want the way like Retrofit + okhttp allow. In OkHttp, I just have to add interceptor at one location and it will log information about each webservice call without writing any other additional code.
In Glide 4.0 RC that's possible via Glide configuration: you can configure Glide's logging level via GlideBuilder#setLogLevel(int).
Having MyGlideModule.java:
#GlideModule
public class MyGlideModule extends AppGlideModule {
#Override
public void applyOptions(Context context, GlideBuilder builder) {
builder.setLogLevel(Log.VERBOSE);
}
}
Then you'll be able to see following log in console:
For older versions (3.x), as mentioned in "Debugging workflow":
To view how and when Glide's internal engine finds the resources you asked for, you can enable logging:
adb shell setprop log.tag.Engine VERBOSE
adb shell setprop log.tag.EngineJob VERBOSE
adb shell setprop log.tag.DecodeJob VERBOSE
This will prompt with following output:
You can enable only Engine logging if you are not interested in other logs.

Trouble reading an XML file in Android

I'm trying to parse an XML file thru a DOM parser. However, I am having difficulty in getting my Main Activity to actually read the file. I've read that I should place the file in Assets and then called with getAssets(). I used something like this:
InputStream is = this.getAssets().open("myXML.xml");
This just results in an error: Unexpected error while launching logcat. Try reselecting the device.] device not found.
I've also tried new File("myXML.xml") using variations on the absolute path. Nothing seems to work. I'm getting a little frustrated. Does anyone have any suggestions?
sounds to me, as if your IDE has no connection to the Emulator or device on which you are trying to test your app.
LogCat is a logging output stream that can be used by any app to print out informations /logs. And LogCat needs to be connected (via ADB) to your device.
If you don't have a real phone connected you can use an emulator:
/path/to/your/androidSDK/tools/android
this SDK manager helps you to create a new AVD (Android Virtual Device). Klick Tools>
Manage ACDs> New...
If you have a real phone or tablet connected to your computer, try restarting ADB
(should be possible from within your IDE) or use the command line.
change to the directory where the Android SDK is installed (in windows something like):
c:\Program Files\Android\android-sdk-windows\platform-tools\
on linux it could be:
/opt/android-sdk-linux/platform-tools/
then type (win and linux)
adb kill-server
adb start-server

Categories