debugging native code for child process in android studio - android

I have an apk with package name a.b.c.d
The main process that gets launched when starting this app is a.b.c.d and it spawns a new process a.b.c.d.e
From android studio, I opened the apk in "Profile/debug apk" option. But, I'm only attach to process a.b.c.d and not to a.b.c.d.e
When I try to attach to the child process the error I get is below:
Starting LLDB server using code injection
Code injection has failed
Debugger detached
Process finished with exit code 0
Any tips on how I can get this working?

Related

EAS Build (Android) .apk Crashes, Expo Build .apk Runs Correctly

I'm updating a React Native app to EAS Build, after using expo build for several years. The app works via the development server.
After running eas build, the .apk file builds successfully, but immediately crashes when opened on a device.
My error log is:
TypeError: undefined is not an object (evaluating 't.indexOf')
Running "main" with {"rootTag":1}
Invariant Violation: "main" has not been registered. This can happen if:
* Metro (the local dev server) is run from the wrong folder. Check if Metro is running, stop it and restart it in the current project.
* A module failed to load due to an error and `AppRegistry.registerComponent` wasn't called.
Has anyone run into this error?
I also had problems, but after reading the documentation some things changed.
Are you migrating an Expo managed app from "expo build"? Learn about the differences.
They must create an index file (reference), with:
import { registerRootComponent } from 'expo';
import App from './src/App';
registerRootComponent(App);
(If the App.js is in the root, delete the /src so they have ./App)
And then, from the package.json, delete the entire line of main.
And [this is the most difficult step]
(https://docs.expo.dev/build-reference/migrating/#metroconfigjs--must-export-the-entire-default
, it cost me
i have the same problem
Invariant Violation: "main" has not been registered. This can happen if:
Metro (the local dev server) is run from the wrong folder. Check if Metro is running, stop it and restart it in the current project.
A module failed to load due to an error and AppRegistry.registerComponent wasn't called.

android.support.v7.widget.RecyclerView: null object reference only when app is opened via appium

Are there any differences between running an app manually and using appium?
Because
It only happens when the app is started by appium. When app is installed and started manually, it runs normally without crashes.
If I want to automatically or manually display the one specific page the app crash “Unfortunately,… has stopped”
There are not any errors about it in appium logs. Only this exception in android monitor:
E/AndroidRuntime: FATAL EXCEPTION: main Process: ..., PID: 26842
java.lang.NullPointerException: Attempt to read from field
'android.support.v7.widget.RecyclerView$Recycler
android.support.v7.widget.RecyclerView.mRecycler' on a null object
reference
at android.support.v7.widget.RecyclerView$LayoutManager.onInitializeAccessibilityNodeInfo(RecyclerView.java:9580)
at android.support.v7.widget.RecyclerViewAccessibilityDelegate.onInitializeAccessibilityNodeInfo(RecyclerViewAccessibilityDelegate.java:59)
at android.support.v4.view.AccessibilityDelegateCompat$AccessibilityDelegateJellyBeanImpl$1.onInitializeAccessibilityNodeInfo(AccessibilityDelegateCompat.java:246)
at android.support.v4.view.AccessibilityDelegateCompatJellyBean$1.onInitializeAccessibilityNodeInfo(AccessibilityDelegateCompatJellyBean.java:66)
at android.view.View.onInitializeAccessibilityNodeInfo(View.java:6076)
at android.view.View.createAccessibilityNodeInfoInternal(View.java:6037)
at android.view.View$AccessibilityDelegate.createAccessibilityNodeInfo(View.java:22281)
at android.view.View.createAccessibilityNodeInfo(View.java:6020)
at android.view.accessibility.AccessibilityRecord.setSource(AccessibilityRecord.java:145)
at android.view.accessibility.AccessibilityRecord.setSource(AccessibilityRecord.java:119)
at android.view.View.onInitializeAccessibilityEventInternal(View.java:5974)
at android.view.View$AccessibilityDelegate.onInitializeAccessibilityEvent(View.java:22193)
at android.support.v4.view.AccessibilityDelegateCompatIcs.onInitializeAccessibilityEvent(AccessibilityDelegateCompatIcs.java:97)
at android.support.v4.view.AccessibilityDelegateCompat$AccessibilityDelegateIcsImpl.onInitializeAccessibilityEvent(AccessibilityDelegateCompat.java:192)
at android.support.v4.view.AccessibilityDelegateCompat.onInitializeAccessibilityEvent(AccessibilityDelegateCompat.java:432)
at android.support.v7.widget.RecyclerViewAccessibilityDelegate.onInitializeAccessibilityEvent(RecyclerViewAccessibilityDelegate.java:65)
at android.support.v4.view.AccessibilityDelegateCompat$AccessibilityDelegateJellyBeanImpl$1.onInitializeAccessibilityEvent(AccessibilityDelegateCompat.java:241)
at android.support.v4.view.AccessibilityDelegateCompatJellyBean$1.onInitializeAccessibilityEvent(AccessibilityDelegateCompatJellyBean.java:61)
at android.view.View.onInitializeAccessibilityEvent(View.java:5960)
at android.view.View.sendAccessibilityEventUncheckedInternal(View.java:5827)
at android.view.View$AccessibilityDelegate.sendAccessibilityEventUnchecked(View.java:22132)
at android.support.v4.view.AccessibilityDelegateCompatIcs.sendAccessibilityEventUnchecked(AccessibilityDelegateCompatIcs.java:122)
at android.support.v4.view.AccessibilityDelegateCompat$AccessibilityDelegateIcsImpl.sendAccessibilityEventUnchecked(AccessibilityDelegateCompat.java:223)
at android.support.v4.view.AccessibilityDelegateCompat.sendAccessibilityEventUnchecked(AccessibilityDelegateCompat.java:371)
at android.support.v4.view.AccessibilityDelegateCompat$AccessibilityDelegateJellyBeanImpl$1.sendAccessibilityEventUnchecked(AccessibilityDelegateCompat.java:268)
at android.support.v4.view.AccessibilityDelegateCompatJellyBean$1.sendAccessibilityEventUnchecked(AccessibilityDelegateCompatJellyBean.java:87)
at android.view.View.sendAccessibilityEventUnchecked(View.java:5810)
at android.support.v7.widget.RecyclerView.sendAccessibilityEventUnchecked(RecyclerView.java:3206)
at android.view.View.sendAccessibilityEventInternal(View.java:5789)
at android.view.View$AccessibilityDelegate.sendAccessibilityEvent(View.java:22090)
at android.support.v4.view.AccessibilityDelegateCompatIcs.sendAccessibilityEvent(AccessibilityDelegateCompatIcs.java:117)
at android.support.v4.view.AccessibilityDelegateCompat$AccessibilityDelegateIcsImpl.sendAccessibilityEvent(AccessibilityDelegateCompat.java:217)
at android.support.v4.view.AccessibilityDelegateCompat.sendAccessibilityEvent(AccessibilityDelegateCompat.java:349)
at android.support.v4.view.AccessibilityDelegateComp
I use appium v1.6.5 (1.7.1) and Android 6.0 - 7.1 emulators
Appium is using adb shell to install/launch app and for elements interactions it use UiAutomator / UiAutomator2 (depends on AutomationName capability you provided)
You can see it in Appium server logs:
install apk:
Running '/Users/<user>/Library/Android/sdk/platform-tools/adb'
with args:["-P",5037,"-s","192.168.56.101:5555","shell","ls",
"/data/local/tmp/f0f1ea15bc776c996fddca878b00c589.apk"]
launch app:
Running '/Users/<user>/Library/Android/sdk/platform-tools/adb'
with args: ["-P",5037,"-s","192.168.56.101:5555","shell","am","start",
"-W","-n","<app_package>/<app_package>.launch.view.LaunchActivity","-S"]
waits for expected activity to be started:
Getting focused package and activity
Running '/Users/dmitry/Library/Android/sdk/platform-tools/adb' with args:
["-P",5037,"-s","192.168.56.101:5555","shell","dumpsys","window","windows"]
Found package: <package> and fully qualified activity name : <activity_name>
finalize session creation:
New AndroidDriver session created successfully,
session 807d2f94-bf31-4107-87ca-848261a4ce15 added to master session list
So you can try the same commands from terminal and see if you can reproduce the crash

React Application biqComfortApp has not been registered.due to require() error during initialisation or failure to call AppRegistry.registerComponent

Cloned the project from Git and started it with react..
Did not do any changes in the code for the project as I just wanted to run it using react..
but I got the following error in the emulator..
Application biqComponentApp has not been registered. This is either due to require() error during initialization or failure to call AppRegistry.registerComponent.
I am using windows 7 but same project up and running without any problem for colleagues with mac computers.Not sure whether it is a problem in the project with windows or any installation problem in windows..
please help to find the issue..
Error in the emulator
Make sure you don't have any other react-native/node process running in another terminal. If you do, close it and then re run it, it works for me.
or else
It could be an error caused by not matching name of project and your registered component.
You have created a project with a certain name, example:
react-native init biqComponentApp
But in your index.android.js file you register other component
AppRegistry.registerComponent('Bananas', () => Bananas);
When it must be
AppRegistry.registerComponent('biqComponentApp', () => Bananas);

Eclipse auxilery app "aapt.exe" keeps crashing

Dose "aapt.exe" write a log file, and if so, how does one view it?
Starting this morning I began getting messages that "aapt.exe has stooped working" "A problem caused the program to stop working correctly...." I turned on "Preferences | Android | Build | Build Output | Verbose" but I don't see any messages in the console, Log Cat or Errors window. This error happens every time a Clean All finishes, and sporadically whenever Eclipse is running (even if it's in the background, sitting idle, with no open code windows.
I found a few entries like this in the Windows Event Viewer. Only the Process ID and Start Time seem to change. The "exception code 0xc0000005" usually indicates an out of bounds memory access (I think.)
Faulting application aapt.exe, version 0.0.0.0, time stamp 0x52684cb5, faulting module aapt.exe, version 0.0.0.0, time stamp 0x52684cb5, exception code 0xc0000005, fault offset 0x0003cf2a, process id 0x428, application start time 0x01cefa0f2db629c3.
I think it started when I forgot to put an opening quote on an .xml string, but I fixed that and it kept happening. I then deleted the entire project the error occurred in and I still get the message.
Comments / ideas welcome - Joe

How do I debug Android native lib in eclipse with ARM DS-5 without going crazy?

I summon the Android NDK debugging Ninjas here!
I've tried so many tutorials about debugging Android native code, so I can't remember them all.
Now I'm trying to get ARM DS-5 work. I've made it work with the Android NDK samples, where the main Activity loads the library. Laggy, but works.
But my project is a little bit complicated. My Main Activity has a button, when I tap it, SubActivity is launched, and it loads native lib. When I just try to use the DS-5 debugger, when Main Activity is loaded, I suppose debugger tries to connect to lib, but fails, saying:
Execution stopped at: 0xAFD0C52C
Connected to unknown platform
0xAFD0C52C POP {r4,r7}
file "D:\workspace\Project\bin\app_process"
WARNING(IMG53): app_process has no line debug information
add-symbol-file "D:\workspace\Project\bin\libc.so"
Loading library symbols: libc.so
WARNING(IMG53): libc.so has no line debug information
Execution stopped at: 0xAFD0C748
In thread 2 (OS thread id 7606)
In __futex_syscall3 (no debug info)
add-symbol-file "D:\workspace\Project\obj\local\armeabi\libName.so"
Execution stopped at: 0xAFD0C748
In thread 3 (OS thread id 7607)
Execution stopped at: 0xAFD0BFFC
In thread 4 (OS thread id 7608)
In __rt_sigtimedwait (no debug info)
Execution stopped at: 0xAFD0B854
In thread 5 (OS thread id 7609)
In select (no debug info)
Execution stopped at: 0xAFD0C748
In thread 6 (OS thread id 7610)
In __futex_syscall3 (no debug info)
Execution stopped at: 0xAFD0B70C
In thread 7 (OS thread id 7611)
In __ioctl (no debug info)
Execution stopped at: 0xAFD0B70C
In thread 8 (OS thread id 7612)
Execution stopped at: 0xAFD0C52C
In thread 1 (OS thread id 7605)
In epoll_wait (no debug info)
0xAFD0C52C POP {r4,r7}
WARNING(CMD454): The shared library D:\workspace\Project\obj\local\armeabi\libName.so is currently not loaded by the application so the request has been pended
cd "D:\workspace"
Working directory "D:\workspace"
directory "D:\workspace\Project"
Source directories searched: D:\workspace\Project;$cdir;$cwd;$idir
break -d -p "D:\workspace\Project\jni\Name.cpp":525
WARNING(CMD452-COR167):
! Breakpoint 1 has been pended
! No compilation unit matching "D:/workspace/Project/jni/Name.cpp" was found
condition 1
break-script 1 ""
ignore 1 0
break-stop-on-threads 1
unsilence 1
Breakpoint 1 unsilenced
I think that it tries to connect to native lib when Main Activity starts. But library is loaded later!
What I tried:
Setting Java breakpoint in SubActivity, after native lib was loaded,
then attaching DS-5 debugger. But I get various errors from Eclipse
saying about timeouts, whatever.
In the debug config settings I can't
select the activity, which should trigger debugging of native code,
there's combobox, but it's disabled:
The question itself: if my lib is not loaded by main Activity, how do I make DS-5 wait for lib to load?
Do you really need to have exact behaviour between debug and release version ?
If not, load the library in the main activity, too in debug version.

Categories

Resources