termux / termux/termux-api

termux:API bug

Open
#245 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
4.3k
Forks
920
PR merge metrics
No merged PRs in 30d

Description

my logcat:


9542
10-20 21:34:08.740 19542 19542 E AndroidRuntime: java.lang.RuntimeException: Unable to start receiver com.termux.api.TermuxApiReceiver: android.util.AndroidRuntimeException: Calling startActivity() from outside of an Activity  context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want?
10-20 21:34:08.740 19542 19542 E AndroidRuntime:        at android.app.ActivityThread.handleReceiver(ActivityThread.java:2928)
10-20 21:34:08.740 19542 19542 E AndroidRuntime:        at android.app.ActivityThread.-wrap14(ActivityThread.java)
10-20 21:34:08.740 19542 19542 E AndroidRuntime:        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1576)
10-20 21:34:08.740 19542 19542 E AndroidRuntime:        at android.os.Handler.dispatchMessage(Handler.java:111)
10-20 21:34:08.740 19542 19542 E AndroidRuntime:        at android.os.Looper.loop(Looper.java:207)
10-20 21:34:08.740 19542 19542 E AndroidRuntime:        at android.app.ActivityThread.main(ActivityThread.java:5765)
10-20 21:34:08.740 19542 19542 E AndroidRuntime:        at java.lang.reflect.Method.invoke(Native Method)
10-20 21:34:08.740 19542 19542 E AndroidRuntime:        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
10-20 21:34:08.740 19542 19542 E AndroidRuntime:        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:679)
10-20 21:34:08.740 19542 19542 E AndroidRuntime: Caused by: android.util.AndroidRuntimeException: Calling startActivity() from outside of an Activity  context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want?
10-20 21:34:08.740 19542 19542 E AndroidRuntime:        at android.app.ContextImpl.startActivity(ContextImpl.java:677)
10-20 21:34:08.740 19542 19542 E AndroidRuntime:        at android.app.ContextImpl.startActivity(ContextImpl.java:664)
10-20 21:34:08.740 19542 19542 E AndroidRuntime:        at android.content.ContextWrapper.startActivity(ContextWrapper.java:331)
10-20 21:34:08.740 19542 19542 E AndroidRuntime:        at android.content.ContextWrapper.startActivity(ContextWrapper.java:331)
10-20 21:34:08.740 19542 19542 E AndroidRuntime:        at com.termux.api.TermuxApiReceiver.onReceive(TermuxApiReceiver.java:68)
10-20 21:34:08.740 19542 19542 E AndroidRuntime:        at android.app.ActivityThread.handleReceiver(ActivityThread.java:2921)
10-20 21:34:08.740 19542 19542 E AndroidRuntime:        ... 8 more
10-20 21:34:50.870 19821 19821 E AndroidRuntime: FATAL EXCEPTION: main
10-20 21:34:50.870 19821 19821 E AndroidRuntime: Process: com.termux.api, PID: 19821

all termux:API commands aren't working

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with TermuxApiReceiver.onReceive at line 68, which the stack trace identifies as the failing entry point. Reproduce an affected Termux:API command and inspect how the receiver launches activities; done means the commands no longer crash with the reported AndroidRuntimeException.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java
Domain
api, mobile
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.