R is a specialized language used for statistical computing and graphics. Statisticians, data analysts, and data miners mostly use R for analysis, visualization, etc.

Popular New Releases in R

ggplot2

ggplot2 3.3.5

dplyr

dplyr 1.0.8

r4ds

First edition

rmarkdown

rmarkdown 2.13

devtools

devtools 2.4.3

Popular Libraries in R

ggplot2

by tidyverse doticonrdoticon

star image 5380 doticonNOASSERTION

An implementation of the Grammar of Graphics in R

awesome-R

by qinwf doticonrdoticon

star image 4695 doticon

A curated list of awesome R packages, frameworks and software.

shiny

by rstudio doticonrdoticon

star image 4565 doticonNOASSERTION

Easy interactive web applications with R

dplyr

by tidyverse doticonrdoticon

star image 3990 doticonNOASSERTION

dplyr: A grammar of data manipulation

swirl_courses

by swirldev doticonrdoticon

star image 3684 doticonGPL-3.0

:mortar_board: A collection of interactive courses for the swirl R package.

ML_for_Hackers

by johnmyleswhite doticonrdoticon

star image 3600 doticon

Code accompanying the book "Machine Learning for Hackers"

AnomalyDetection

by twitter doticonrdoticon

star image 3348 doticonGPL-3.0

Anomaly Detection with R

r4ds

by hadley doticonrdoticon

star image 3060 doticonNOASSERTION

R for data science: a book

data.table

by Rdatatable doticonrdoticon

star image 3002 doticonMPL-2.0

R's data.table package extends data.frame:

Trending New libraries in R

stat_rethinking_2022

by rmcelreath doticonrdoticon

star image 2223 doticon

Statistical Rethinking course winter 2022

palmerpenguins

by allisonhorst doticonrdoticon

star image 577 doticonCC0-1.0

A great intro dataset for data exploration & visualization (alternative to iris).

stat_rethinking_2020

by rmcelreath doticonrdoticon

star image 557 doticon

Statistical Rethinking Course Winter 2020/2021

2020nCov_individual_archives

by jiayiliujiayi doticonrdoticon

star image 539 doticon

"Every individual matters. Every individual has a role to play." This is a repository that archives the individual stories during the COVID19 pandemic. 备份普通人在疫情期间的记录。(持续翻译 & 更新中)

covid-19-excess-deaths-tracker

by TheEconomist doticonrdoticon

star image 484 doticon

Source code and data for The Economist's covid-19 excess deaths tracker

ggdist

by mjskay doticonrdoticon

star image 427 doticonGPL-3.0

Visualizations of distributions and uncertainty

nCov2019

by GuangchuangYu doticonrdoticon

star image 419 doticon

query stats of infected coronavirus cases

Robyn

by facebookexperimental doticonrdoticon

star image 410 doticonMIT

Robyn is an experimental, automated and open-sourced Marketing Mix Modeling (MMM) package from Facebook Marketing Science. It uses various machine learning techniques (Ridge regression with cross validation, multi-objective evolutionary algorithm for hyperparameter optimisation, gradient-based optimisation for budget allocation etc.) to define media channel efficiency and effectivity, explore adstock rates and saturation curves. It's built for granular datasets with many independent variables and therefore especially suitable for digital and direct response advertisers with rich dataset.

coronavirus

by RamiKrispin doticonrdoticon

star image 396 doticonNOASSERTION

The coronavirus dataset

Top Authors in R

1

cran

4919 Libraries

star icon5115

2

hrbrmstr

312 Libraries

star icon5768

3

ropensci

302 Libraries

star icon19147

4

info-201a-wi22

173 Libraries

star icon16

5

ropensci-archive

124 Libraries

star icon2138

6

rstudio

112 Libraries

star icon24452

7

bcgov

107 Libraries

star icon693

8

mrc-ide

104 Libraries

star icon571

9

r-forge

101 Libraries

star icon151

10

mkearney

98 Libraries

star icon2338

1

4919 Libraries

star icon5115

2

312 Libraries

star icon5768

3

302 Libraries

star icon19147

4

173 Libraries

star icon16

5

124 Libraries

star icon2138

6

112 Libraries

star icon24452

7

107 Libraries

star icon693

8

104 Libraries

star icon571

9

101 Libraries

star icon151

10

98 Libraries

star icon2338

Trending Kits in R

No Trending Kits are available at this moment for R

Trending Discussions on R

Python/Docker ImportError: cannot import name 'json' from itsdangerous

Error: require() of ES modules is not supported when importing node-fetch

CentOS through a VM - no URLs in mirrorlist

Java, Intellij IDEA problem Unrecognized option: --add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED

Error while downloading the requirements using pip install (setup command: use_2to3 is invalid.)

WARNING: Running pip as the 'root' user

android:exported needs to be explicitly specified for <activity>. Apps targeting Android 12 and higher are required to specify

How to open emulators in different windows at Android Studio (Bumblebee | 2021.1.1)?

How to install the Bumblebee 2021.1.1 Android Studio Patch?

Is there way in ggplot2 to place text on a curved path?

QUESTION

Python/Docker ImportError: cannot import name 'json' from itsdangerous

Asked 2022-Mar-31 at 12:49

I am trying to get a Flask and Docker application to work but when I try and run it using my docker-compose up command in my Visual Studio terminal, it gives me an ImportError called ImportError: cannot import name 'json' from itsdangerous. I have tried to look for possible solutions to this problem but as of right now there are not many on here or anywhere else. The only two solutions I could find are to change the current installation of MarkupSafe and itsdangerous to a higher version: https://serverfault.com/questions/1094062/from-itsdangerous-import-json-as-json-importerror-cannot-import-name-json-fr and another one on GitHub that tells me to essentially change the MarkUpSafe and itsdangerous installation again https://github.com/aws/aws-sam-cli/issues/3661, I have also tried to make a virtual environment named veganetworkscriptenv to install the packages but that has also failed as well. I am currently using Flask 2.0.0 and Docker 5.0.0 and the error occurs on line eight in vegamain.py.

Here is the full ImportError that I get when I try and run the program:

1veganetworkscript-backend-1  | Traceback (most recent call last):
2veganetworkscript-backend-1  |   File "/app/vegamain.py", line 8, in <module>
3veganetworkscript-backend-1  |     from flask import Flask
4veganetworkscript-backend-1  |   File "/usr/local/lib/python3.9/site-packages/flask/__init__.py", line 19, in <module>
5veganetworkscript-backend-1  |     from . import json
6veganetworkscript-backend-1  |   File "/usr/local/lib/python3.9/site-packages/flask/json/__init__.py", line 15, in <module>
7veganetworkscript-backend-1  |     from itsdangerous import json as _json
8veganetworkscript-backend-1  | ImportError: cannot import name 'json' from 'itsdangerous' (/usr/local/lib/python3.9/site-packages/itsdangerous/__init__.py)
9veganetworkscript-backend-1 exited with code 1
10

Here are my requirements.txt, vegamain.py, Dockerfile, and docker-compose.yml files:

requirements.txt:

1veganetworkscript-backend-1  | Traceback (most recent call last):
2veganetworkscript-backend-1  |   File "/app/vegamain.py", line 8, in <module>
3veganetworkscript-backend-1  |     from flask import Flask
4veganetworkscript-backend-1  |   File "/usr/local/lib/python3.9/site-packages/flask/__init__.py", line 19, in <module>
5veganetworkscript-backend-1  |     from . import json
6veganetworkscript-backend-1  |   File "/usr/local/lib/python3.9/site-packages/flask/json/__init__.py", line 15, in <module>
7veganetworkscript-backend-1  |     from itsdangerous import json as _json
8veganetworkscript-backend-1  | ImportError: cannot import name 'json' from 'itsdangerous' (/usr/local/lib/python3.9/site-packages/itsdangerous/__init__.py)
9veganetworkscript-backend-1 exited with code 1
10Flask==2.0.0
11Flask-SQLAlchemy==2.4.4
12SQLAlchemy==1.3.20
13Flask-Migrate==2.5.3
14Flask-Script==2.0.6
15Flask-Cors==3.0.9
16requests==2.25.0
17mysqlclient==2.0.1
18pika==1.1.0
19wolframalpha==4.3.0
20

vegamain.py:

1veganetworkscript-backend-1  | Traceback (most recent call last):
2veganetworkscript-backend-1  |   File "/app/vegamain.py", line 8, in <module>
3veganetworkscript-backend-1  |     from flask import Flask
4veganetworkscript-backend-1  |   File "/usr/local/lib/python3.9/site-packages/flask/__init__.py", line 19, in <module>
5veganetworkscript-backend-1  |     from . import json
6veganetworkscript-backend-1  |   File "/usr/local/lib/python3.9/site-packages/flask/json/__init__.py", line 15, in <module>
7veganetworkscript-backend-1  |     from itsdangerous import json as _json
8veganetworkscript-backend-1  | ImportError: cannot import name 'json' from 'itsdangerous' (/usr/local/lib/python3.9/site-packages/itsdangerous/__init__.py)
9veganetworkscript-backend-1 exited with code 1
10Flask==2.0.0
11Flask-SQLAlchemy==2.4.4
12SQLAlchemy==1.3.20
13Flask-Migrate==2.5.3
14Flask-Script==2.0.6
15Flask-Cors==3.0.9
16requests==2.25.0
17mysqlclient==2.0.1
18pika==1.1.0
19wolframalpha==4.3.0
20# Veganetwork (C) TetraSystemSolutions 2022
21# all rights are reserved.  
22# 
23# Author: Trevor R. Blanchard Feb-19-2022-Jul-30-2022
24#
25
26# get our imports in order first
27from flask import Flask # <-- error occurs here!!!
28
29# start the application through flask.
30app = Flask(__name__)
31
32# if set to true will return only a "Hello World" string.
33Debug = True
34
35# start a route to the index part of the app in flask.
36@app.route('/')
37def index():
38    if (Debug == True):
39        return 'Hello World!'
40    else:
41        pass
42
43# start the flask app here --->
44if __name__ == '__main__':
45    app.run(debug=True, host='0.0.0.0') 
46

Dockerfile:

1veganetworkscript-backend-1  | Traceback (most recent call last):
2veganetworkscript-backend-1  |   File "/app/vegamain.py", line 8, in <module>
3veganetworkscript-backend-1  |     from flask import Flask
4veganetworkscript-backend-1  |   File "/usr/local/lib/python3.9/site-packages/flask/__init__.py", line 19, in <module>
5veganetworkscript-backend-1  |     from . import json
6veganetworkscript-backend-1  |   File "/usr/local/lib/python3.9/site-packages/flask/json/__init__.py", line 15, in <module>
7veganetworkscript-backend-1  |     from itsdangerous import json as _json
8veganetworkscript-backend-1  | ImportError: cannot import name 'json' from 'itsdangerous' (/usr/local/lib/python3.9/site-packages/itsdangerous/__init__.py)
9veganetworkscript-backend-1 exited with code 1
10Flask==2.0.0
11Flask-SQLAlchemy==2.4.4
12SQLAlchemy==1.3.20
13Flask-Migrate==2.5.3
14Flask-Script==2.0.6
15Flask-Cors==3.0.9
16requests==2.25.0
17mysqlclient==2.0.1
18pika==1.1.0
19wolframalpha==4.3.0
20# Veganetwork (C) TetraSystemSolutions 2022
21# all rights are reserved.  
22# 
23# Author: Trevor R. Blanchard Feb-19-2022-Jul-30-2022
24#
25
26# get our imports in order first
27from flask import Flask # <-- error occurs here!!!
28
29# start the application through flask.
30app = Flask(__name__)
31
32# if set to true will return only a "Hello World" string.
33Debug = True
34
35# start a route to the index part of the app in flask.
36@app.route('/')
37def index():
38    if (Debug == True):
39        return 'Hello World!'
40    else:
41        pass
42
43# start the flask app here --->
44if __name__ == '__main__':
45    app.run(debug=True, host='0.0.0.0') 
46FROM python:3.9
47ENV PYTHONUNBUFFERED 1
48WORKDIR /app
49COPY requirements.txt /app/requirements.txt
50RUN pip install -r requirements.txt
51COPY . /app
52

docker-compose.yml:

1veganetworkscript-backend-1  | Traceback (most recent call last):
2veganetworkscript-backend-1  |   File "/app/vegamain.py", line 8, in <module>
3veganetworkscript-backend-1  |     from flask import Flask
4veganetworkscript-backend-1  |   File "/usr/local/lib/python3.9/site-packages/flask/__init__.py", line 19, in <module>
5veganetworkscript-backend-1  |     from . import json
6veganetworkscript-backend-1  |   File "/usr/local/lib/python3.9/site-packages/flask/json/__init__.py", line 15, in <module>
7veganetworkscript-backend-1  |     from itsdangerous import json as _json
8veganetworkscript-backend-1  | ImportError: cannot import name 'json' from 'itsdangerous' (/usr/local/lib/python3.9/site-packages/itsdangerous/__init__.py)
9veganetworkscript-backend-1 exited with code 1
10Flask==2.0.0
11Flask-SQLAlchemy==2.4.4
12SQLAlchemy==1.3.20
13Flask-Migrate==2.5.3
14Flask-Script==2.0.6
15Flask-Cors==3.0.9
16requests==2.25.0
17mysqlclient==2.0.1
18pika==1.1.0
19wolframalpha==4.3.0
20# Veganetwork (C) TetraSystemSolutions 2022
21# all rights are reserved.  
22# 
23# Author: Trevor R. Blanchard Feb-19-2022-Jul-30-2022
24#
25
26# get our imports in order first
27from flask import Flask # <-- error occurs here!!!
28
29# start the application through flask.
30app = Flask(__name__)
31
32# if set to true will return only a "Hello World" string.
33Debug = True
34
35# start a route to the index part of the app in flask.
36@app.route('/')
37def index():
38    if (Debug == True):
39        return 'Hello World!'
40    else:
41        pass
42
43# start the flask app here --->
44if __name__ == '__main__':
45    app.run(debug=True, host='0.0.0.0') 
46FROM python:3.9
47ENV PYTHONUNBUFFERED 1
48WORKDIR /app
49COPY requirements.txt /app/requirements.txt
50RUN pip install -r requirements.txt
51COPY . /app
52version: '3.8'
53services:
54  backend:
55    build:
56      context: .
57      dockerfile: Dockerfile
58    command: 'python vegamain.py'
59    ports:
60      - 8004:5000
61    volumes:
62      - .:/app
63    depends_on:
64      - db
65
66#  queue:
67#    build:
68#      context: .
69#      dockerfile: Dockerfile
70#    command: 'python -u consumer.py'
71#    depends_on:
72#      - db
73
74  db:
75    image: mysql:5.7.22
76    restart: always
77    environment:
78      MYSQL_DATABASE: admin
79      MYSQL_USER: root
80      MYSQL_PASSWORD: root
81      MYSQL_ROOT_PASSWORD: root
82    volumes:
83      - .dbdata:/var/lib/mysql
84    ports:
85      - 33069:3306
86

How exactly can I fix this code? thank you!

ANSWER

Answered 2022-Feb-20 at 12:31

I was facing the same issue while running docker containers with flask.

I downgraded Flask to 1.1.4 and markupsafe to 2.0.1 which solved my issue.

Check this for reference.

Source https://stackoverflow.com/questions/71189819

QUESTION

Error: require() of ES modules is not supported when importing node-fetch

Asked 2022-Mar-28 at 07:04

I'm creating a program to analyze security camera streams and got stuck on the very first line. At the moment my .js file has nothing but the import of node-fetch and it gives me an error message. What am I doing wrong?

Running Ubuntu 20.04.2 LTS in Windows Subsystem for Linux.

Node version:

1user@MYLLYTIN:~/CAMSERVER$ node -v
2v14.17.6
3

node-fetch package version:

1user@MYLLYTIN:~/CAMSERVER$ node -v
2v14.17.6
3user@MYLLYTIN:~/CAMSERVER$ npm v node-fetch
4
5node-fetch@3.0.0 | MIT | deps: 2 | versions: 63
6A light-weight module that brings Fetch API to node.js
7https://github.com/node-fetch/node-fetch
8
9keywords: fetch, http, promise, request, curl, wget, xhr, whatwg
10
11dist
12.tarball: https://registry.npmjs.org/node-fetch/-/node-fetch-3.0.0.tgz
13.shasum: 79da7146a520036f2c5f644e4a26095f17e411ea
14.integrity: sha512-bKMI+C7/T/SPU1lKnbQbwxptpCrG9ashG+VkytmXCPZyuM9jB6VU+hY0oi4lC8LxTtAeWdckNCTa3nrGsAdA3Q==
15.unpackedSize: 75.9 kB
16
17dependencies:
18data-uri-to-buffer: ^3.0.1 fetch-blob: ^3.1.2         
19
20maintainers:
21- endless <jimmy@warting.se>
22- bitinn <bitinn@gmail.com>
23- timothygu <timothygu99@gmail.com>
24- akepinski <npm@kepinski.ch>
25
26dist-tags:
27latest: 3.0.0        next: 3.0.0-beta.10  
28
29published 3 days ago by endless <jimmy@warting.se>
30

esm package version:

1user@MYLLYTIN:~/CAMSERVER$ node -v
2v14.17.6
3user@MYLLYTIN:~/CAMSERVER$ npm v node-fetch
4
5node-fetch@3.0.0 | MIT | deps: 2 | versions: 63
6A light-weight module that brings Fetch API to node.js
7https://github.com/node-fetch/node-fetch
8
9keywords: fetch, http, promise, request, curl, wget, xhr, whatwg
10
11dist
12.tarball: https://registry.npmjs.org/node-fetch/-/node-fetch-3.0.0.tgz
13.shasum: 79da7146a520036f2c5f644e4a26095f17e411ea
14.integrity: sha512-bKMI+C7/T/SPU1lKnbQbwxptpCrG9ashG+VkytmXCPZyuM9jB6VU+hY0oi4lC8LxTtAeWdckNCTa3nrGsAdA3Q==
15.unpackedSize: 75.9 kB
16
17dependencies:
18data-uri-to-buffer: ^3.0.1 fetch-blob: ^3.1.2         
19
20maintainers:
21- endless <jimmy@warting.se>
22- bitinn <bitinn@gmail.com>
23- timothygu <timothygu99@gmail.com>
24- akepinski <npm@kepinski.ch>
25
26dist-tags:
27latest: 3.0.0        next: 3.0.0-beta.10  
28
29published 3 days ago by endless <jimmy@warting.se>
30user@MYLLYTIN:~/CAMSERVER$ npm v esm
31
32esm@3.2.25 | MIT | deps: none | versions: 140
33Tomorrow's ECMAScript modules today!
34https://github.com/standard-things/esm#readme
35
36keywords: commonjs, ecmascript, export, import, modules, node, require
37
38dist
39.tarball: https://registry.npmjs.org/esm/-/esm-3.2.25.tgz
40.shasum: 342c18c29d56157688ba5ce31f8431fbb795cc10
41.integrity: sha512-U1suiZ2oDVWv4zPO56S0NcR5QriEahGtdN2OR6FiOG4WJvcjBVFB0qI4+eKoWFH483PKGuLuu6V8Z4T5g63UVA==
42.unpackedSize: 308.6 kB
43
44maintainers:
45- jdalton <john.david.dalton@gmail.com>
46
47dist-tags:
48latest: 3.2.25  
49
50published over a year ago by jdalton <john.david.dalton@gmail.com>
51

Contents of the .js file (literally nothing but the import):

1user@MYLLYTIN:~/CAMSERVER$ node -v
2v14.17.6
3user@MYLLYTIN:~/CAMSERVER$ npm v node-fetch
4
5node-fetch@3.0.0 | MIT | deps: 2 | versions: 63
6A light-weight module that brings Fetch API to node.js
7https://github.com/node-fetch/node-fetch
8
9keywords: fetch, http, promise, request, curl, wget, xhr, whatwg
10
11dist
12.tarball: https://registry.npmjs.org/node-fetch/-/node-fetch-3.0.0.tgz
13.shasum: 79da7146a520036f2c5f644e4a26095f17e411ea
14.integrity: sha512-bKMI+C7/T/SPU1lKnbQbwxptpCrG9ashG+VkytmXCPZyuM9jB6VU+hY0oi4lC8LxTtAeWdckNCTa3nrGsAdA3Q==
15.unpackedSize: 75.9 kB
16
17dependencies:
18data-uri-to-buffer: ^3.0.1 fetch-blob: ^3.1.2         
19
20maintainers:
21- endless <jimmy@warting.se>
22- bitinn <bitinn@gmail.com>
23- timothygu <timothygu99@gmail.com>
24- akepinski <npm@kepinski.ch>
25
26dist-tags:
27latest: 3.0.0        next: 3.0.0-beta.10  
28
29published 3 days ago by endless <jimmy@warting.se>
30user@MYLLYTIN:~/CAMSERVER$ npm v esm
31
32esm@3.2.25 | MIT | deps: none | versions: 140
33Tomorrow's ECMAScript modules today!
34https://github.com/standard-things/esm#readme
35
36keywords: commonjs, ecmascript, export, import, modules, node, require
37
38dist
39.tarball: https://registry.npmjs.org/esm/-/esm-3.2.25.tgz
40.shasum: 342c18c29d56157688ba5ce31f8431fbb795cc10
41.integrity: sha512-U1suiZ2oDVWv4zPO56S0NcR5QriEahGtdN2OR6FiOG4WJvcjBVFB0qI4+eKoWFH483PKGuLuu6V8Z4T5g63UVA==
42.unpackedSize: 308.6 kB
43
44maintainers:
45- jdalton <john.david.dalton@gmail.com>
46
47dist-tags:
48latest: 3.2.25  
49
50published over a year ago by jdalton <john.david.dalton@gmail.com>
51user@MYLLYTIN:~/CAMSERVER$ cat server.js 
52import fetch from "node-fetch";
53

Result:

1user@MYLLYTIN:~/CAMSERVER$ node -v
2v14.17.6
3user@MYLLYTIN:~/CAMSERVER$ npm v node-fetch
4
5node-fetch@3.0.0 | MIT | deps: 2 | versions: 63
6A light-weight module that brings Fetch API to node.js
7https://github.com/node-fetch/node-fetch
8
9keywords: fetch, http, promise, request, curl, wget, xhr, whatwg
10
11dist
12.tarball: https://registry.npmjs.org/node-fetch/-/node-fetch-3.0.0.tgz
13.shasum: 79da7146a520036f2c5f644e4a26095f17e411ea
14.integrity: sha512-bKMI+C7/T/SPU1lKnbQbwxptpCrG9ashG+VkytmXCPZyuM9jB6VU+hY0oi4lC8LxTtAeWdckNCTa3nrGsAdA3Q==
15.unpackedSize: 75.9 kB
16
17dependencies:
18data-uri-to-buffer: ^3.0.1 fetch-blob: ^3.1.2         
19
20maintainers:
21- endless <jimmy@warting.se>
22- bitinn <bitinn@gmail.com>
23- timothygu <timothygu99@gmail.com>
24- akepinski <npm@kepinski.ch>
25
26dist-tags:
27latest: 3.0.0        next: 3.0.0-beta.10  
28
29published 3 days ago by endless <jimmy@warting.se>
30user@MYLLYTIN:~/CAMSERVER$ npm v esm
31
32esm@3.2.25 | MIT | deps: none | versions: 140
33Tomorrow's ECMAScript modules today!
34https://github.com/standard-things/esm#readme
35
36keywords: commonjs, ecmascript, export, import, modules, node, require
37
38dist
39.tarball: https://registry.npmjs.org/esm/-/esm-3.2.25.tgz
40.shasum: 342c18c29d56157688ba5ce31f8431fbb795cc10
41.integrity: sha512-U1suiZ2oDVWv4zPO56S0NcR5QriEahGtdN2OR6FiOG4WJvcjBVFB0qI4+eKoWFH483PKGuLuu6V8Z4T5g63UVA==
42.unpackedSize: 308.6 kB
43
44maintainers:
45- jdalton <john.david.dalton@gmail.com>
46
47dist-tags:
48latest: 3.2.25  
49
50published over a year ago by jdalton <john.david.dalton@gmail.com>
51user@MYLLYTIN:~/CAMSERVER$ cat server.js 
52import fetch from "node-fetch";
53user@MYLLYTIN:~/CAMSERVER$ node -r esm server.js 
54/home/user/CAMSERVER/node_modules/node-fetch/src/index.js:1
55Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: /home/user/CAMSERVER/node_modules/node-fetch/src/index.js
56require() of ES modules is not supported.
57require() of /home/user/CAMSERVER/node_modules/node-fetch/src/index.js from /home/user/CAMSERVER/server.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
58Instead rename index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /home/user/CAMSERVER/node_modules/node-fetch/package.json.
59
60    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1089:13) {
61  code: 'ERR_REQUIRE_ESM'
62}
63user@MYLLYTIN:~/CAMSERVER$ 
64

ANSWER

Answered 2022-Feb-25 at 00:00

Use ESM syntax, also use one of these methods before running the file.

  1. specify "type":"module" in package.json
  2. Or use this flag --input-type=module when running the file
  3. Or use .mjs file extension

Source https://stackoverflow.com/questions/69041454

QUESTION

CentOS through a VM - no URLs in mirrorlist

Asked 2022-Mar-26 at 21:04

I am trying to run a CentOS 8 server through VirtualBox (6.1.30) (Vagrant), which worked just fine yesterday for me, but today I tried running a sudo yum update. I keep getting this error for some reason:

1[vagrant@192.168.38.4] ~  >> sudo yum update
2CentOS Linux 8 - AppStream                       71  B/s |  38  B     00:00
3Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist
4

I already tried to change the namespaces on /etc/resolve.conf, remove the DNF folders and everything. On other computers, this works just fine, so I think the problem is with my host machine. I also tried to reset the network settings (I am on a Windows 10 host), without success either. It's not a DNS problem; it works just fine.

After I reinstalled Windows, I still have the same error in my VM.

File dnf.log:

1[vagrant@192.168.38.4] ~  >> sudo yum update
2CentOS Linux 8 - AppStream                       71  B/s |  38  B     00:00
3Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist
42022-01-31T15:28:03+0000 INFO --- logging initialized ---
52022-01-31T15:28:03+0000 DDEBUG timer: config: 2 ms
62022-01-31T15:28:03+0000 DEBUG Loaded plugins: builddep, changelog, config-manager, copr, debug, debuginfo-install, download, generate_completion_cache, groups-manager, needs-restarting, playground, repoclosure, repodiff, repograph, repomanage, reposync
72022-01-31T15:28:03+0000 DEBUG YUM version: 4.4.2
82022-01-31T15:28:03+0000 DDEBUG Command: yum update
92022-01-31T15:28:03+0000 DDEBUG Installroot: /
102022-01-31T15:28:03+0000 DDEBUG Releasever: 8
112022-01-31T15:28:03+0000 DEBUG cachedir: /var/cache/dnf
122022-01-31T15:28:03+0000 DDEBUG Base command: update
132022-01-31T15:28:03+0000 DDEBUG Extra commands: ['update']
142022-01-31T15:28:03+0000 DEBUG User-Agent: constructed: 'libdnf (CentOS Linux 8; generic; Linux.x86_64)'
152022-01-31T15:28:05+0000 DDEBUG Cleaning up.
162022-01-31T15:28:05+0000 SUBDEBUG
17Traceback (most recent call last):
18  File "/usr/lib/python3.6/site-packages/dnf/repo.py", line 574, in load
19    ret = self._repo.load()
20  File "/usr/lib64/python3.6/site-packages/libdnf/repo.py", line 397, in load
21    return _repo.Repo_load(self)
22libdnf._error.Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist
23
24During handling of the above exception, another exception occurred:
25
26Traceback (most recent call last):
27  File "/usr/lib/python3.6/site-packages/dnf/cli/main.py", line 67, in main
28    return _main(base, args, cli_class, option_parser_class)
29  File "/usr/lib/python3.6/site-packages/dnf/cli/main.py", line 106, in _main
30    return cli_run(cli, base)
31  File "/usr/lib/python3.6/site-packages/dnf/cli/main.py", line 122, in cli_run
32    cli.run()
33  File "/usr/lib/python3.6/site-packages/dnf/cli/cli.py", line 1050, in run
34    self._process_demands()
35  File "/usr/lib/python3.6/site-packages/dnf/cli/cli.py", line 740, in _process_demands
36    load_available_repos=self.demands.available_repos)
37  File "/usr/lib/python3.6/site-packages/dnf/base.py", line 394, in fill_sack
38    self._add_repo_to_sack(r)
39  File "/usr/lib/python3.6/site-packages/dnf/base.py", line 137, in _add_repo_to_sack
40    repo.load()
41  File "/usr/lib/python3.6/site-packages/dnf/repo.py", line 581, in load
42    raise dnf.exceptions.RepoError(str(e))
43dnf.exceptions.RepoError: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist
442022-01-31T15:28:05+0000 CRITICAL Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist
45

ANSWER

Answered 2022-Mar-26 at 20:59

Check out this article: CentOS Linux EOL

The below commands helped me:

1[vagrant@192.168.38.4] ~  >> sudo yum update
2CentOS Linux 8 - AppStream                       71  B/s |  38  B     00:00
3Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist
42022-01-31T15:28:03+0000 INFO --- logging initialized ---
52022-01-31T15:28:03+0000 DDEBUG timer: config: 2 ms
62022-01-31T15:28:03+0000 DEBUG Loaded plugins: builddep, changelog, config-manager, copr, debug, debuginfo-install, download, generate_completion_cache, groups-manager, needs-restarting, playground, repoclosure, repodiff, repograph, repomanage, reposync
72022-01-31T15:28:03+0000 DEBUG YUM version: 4.4.2
82022-01-31T15:28:03+0000 DDEBUG Command: yum update
92022-01-31T15:28:03+0000 DDEBUG Installroot: /
102022-01-31T15:28:03+0000 DDEBUG Releasever: 8
112022-01-31T15:28:03+0000 DEBUG cachedir: /var/cache/dnf
122022-01-31T15:28:03+0000 DDEBUG Base command: update
132022-01-31T15:28:03+0000 DDEBUG Extra commands: ['update']
142022-01-31T15:28:03+0000 DEBUG User-Agent: constructed: 'libdnf (CentOS Linux 8; generic; Linux.x86_64)'
152022-01-31T15:28:05+0000 DDEBUG Cleaning up.
162022-01-31T15:28:05+0000 SUBDEBUG
17Traceback (most recent call last):
18  File "/usr/lib/python3.6/site-packages/dnf/repo.py", line 574, in load
19    ret = self._repo.load()
20  File "/usr/lib64/python3.6/site-packages/libdnf/repo.py", line 397, in load
21    return _repo.Repo_load(self)
22libdnf._error.Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist
23
24During handling of the above exception, another exception occurred:
25
26Traceback (most recent call last):
27  File "/usr/lib/python3.6/site-packages/dnf/cli/main.py", line 67, in main
28    return _main(base, args, cli_class, option_parser_class)
29  File "/usr/lib/python3.6/site-packages/dnf/cli/main.py", line 106, in _main
30    return cli_run(cli, base)
31  File "/usr/lib/python3.6/site-packages/dnf/cli/main.py", line 122, in cli_run
32    cli.run()
33  File "/usr/lib/python3.6/site-packages/dnf/cli/cli.py", line 1050, in run
34    self._process_demands()
35  File "/usr/lib/python3.6/site-packages/dnf/cli/cli.py", line 740, in _process_demands
36    load_available_repos=self.demands.available_repos)
37  File "/usr/lib/python3.6/site-packages/dnf/base.py", line 394, in fill_sack
38    self._add_repo_to_sack(r)
39  File "/usr/lib/python3.6/site-packages/dnf/base.py", line 137, in _add_repo_to_sack
40    repo.load()
41  File "/usr/lib/python3.6/site-packages/dnf/repo.py", line 581, in load
42    raise dnf.exceptions.RepoError(str(e))
43dnf.exceptions.RepoError: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist
442022-01-31T15:28:05+0000 CRITICAL Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist
45sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-Linux-*
46sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-Linux-*
47

Doing this will make DNF work, but you will no longer receive any updates.

To upgrade to CentOS 8 stream:

1[vagrant@192.168.38.4] ~  >> sudo yum update
2CentOS Linux 8 - AppStream                       71  B/s |  38  B     00:00
3Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist
42022-01-31T15:28:03+0000 INFO --- logging initialized ---
52022-01-31T15:28:03+0000 DDEBUG timer: config: 2 ms
62022-01-31T15:28:03+0000 DEBUG Loaded plugins: builddep, changelog, config-manager, copr, debug, debuginfo-install, download, generate_completion_cache, groups-manager, needs-restarting, playground, repoclosure, repodiff, repograph, repomanage, reposync
72022-01-31T15:28:03+0000 DEBUG YUM version: 4.4.2
82022-01-31T15:28:03+0000 DDEBUG Command: yum update
92022-01-31T15:28:03+0000 DDEBUG Installroot: /
102022-01-31T15:28:03+0000 DDEBUG Releasever: 8
112022-01-31T15:28:03+0000 DEBUG cachedir: /var/cache/dnf
122022-01-31T15:28:03+0000 DDEBUG Base command: update
132022-01-31T15:28:03+0000 DDEBUG Extra commands: ['update']
142022-01-31T15:28:03+0000 DEBUG User-Agent: constructed: 'libdnf (CentOS Linux 8; generic; Linux.x86_64)'
152022-01-31T15:28:05+0000 DDEBUG Cleaning up.
162022-01-31T15:28:05+0000 SUBDEBUG
17Traceback (most recent call last):
18  File "/usr/lib/python3.6/site-packages/dnf/repo.py", line 574, in load
19    ret = self._repo.load()
20  File "/usr/lib64/python3.6/site-packages/libdnf/repo.py", line 397, in load
21    return _repo.Repo_load(self)
22libdnf._error.Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist
23
24During handling of the above exception, another exception occurred:
25
26Traceback (most recent call last):
27  File "/usr/lib/python3.6/site-packages/dnf/cli/main.py", line 67, in main
28    return _main(base, args, cli_class, option_parser_class)
29  File "/usr/lib/python3.6/site-packages/dnf/cli/main.py", line 106, in _main
30    return cli_run(cli, base)
31  File "/usr/lib/python3.6/site-packages/dnf/cli/main.py", line 122, in cli_run
32    cli.run()
33  File "/usr/lib/python3.6/site-packages/dnf/cli/cli.py", line 1050, in run
34    self._process_demands()
35  File "/usr/lib/python3.6/site-packages/dnf/cli/cli.py", line 740, in _process_demands
36    load_available_repos=self.demands.available_repos)
37  File "/usr/lib/python3.6/site-packages/dnf/base.py", line 394, in fill_sack
38    self._add_repo_to_sack(r)
39  File "/usr/lib/python3.6/site-packages/dnf/base.py", line 137, in _add_repo_to_sack
40    repo.load()
41  File "/usr/lib/python3.6/site-packages/dnf/repo.py", line 581, in load
42    raise dnf.exceptions.RepoError(str(e))
43dnf.exceptions.RepoError: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist
442022-01-31T15:28:05+0000 CRITICAL Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist
45sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-Linux-*
46sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-Linux-*
47sudo dnf install centos-release-stream -y
48sudo dnf swap centos-{linux,stream}-repos -y
49sudo dnf distro-sync -y
50

Optionally reboot if your kernel updated (not needed in containers).

Source https://stackoverflow.com/questions/70926799

QUESTION

Java, Intellij IDEA problem Unrecognized option: --add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED

Asked 2022-Mar-26 at 15:23

I have newly installed

1IntelliJ IDEA 2021.2 (Ultimate Edition)
2Build #IU-212.4746.92, built on July 27, 2021
3Licensed to XXXXXX
4Subscription is active until August 15, 2021.
5Runtime version: 11.0.11+9-b1504.13 amd64
6VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
7Linux 5.4.0-80-generic
8GC: G1 Young Generation, G1 Old Generation
9Memory: 2048M
10Cores: 3
11
12Kotlin: 212-1.5.10-release-IJ4746.92
13Current Desktop: X-Cinnamon
14

I cloned project I work with on other workstation without issues, but cannot start any class with main method and IDEA says:

1IntelliJ IDEA 2021.2 (Ultimate Edition)
2Build #IU-212.4746.92, built on July 27, 2021
3Licensed to XXXXXX
4Subscription is active until August 15, 2021.
5Runtime version: 11.0.11+9-b1504.13 amd64
6VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
7Linux 5.4.0-80-generic
8GC: G1 Young Generation, G1 Old Generation
9Memory: 2048M
10Cores: 3
11
12Kotlin: 212-1.5.10-release-IJ4746.92
13Current Desktop: X-Cinnamon
14Abnormal build process termination: 
15/usr/lib/jvm/java-1.8.0-openjdk-amd64/bin/java -Xmx700m -Djava.awt.headless=true -Djava.endorsed.dirs=\"\" -Dcompile.parallel=false -Drebuild.on.dependency.change=true -Djdt.compiler.useSingleThread=true -Daether.connector.resumeDownloads=false -Dio.netty.initialSeedUniquifier=-5972351880001011455 -Dfile.encoding=UTF-8 -Duser.language=en -Duser.country=US -Didea.paths.selector=IntelliJIdea2021.2 -Didea.home.path=/home/pm/idea-IU-212.4746.92 -Didea.config.path=/home/pm/.config/JetBrains/IntelliJIdea2021.2 -Didea.plugins.path=/home/pm/.local/share/JetBrains/IntelliJIdea2021.2 -Djps.log.dir=/home/pm/.cache/JetBrains/IntelliJIdea2021.2/log/build-log -Djps.fallback.jdk.home=/home/pm/idea-IU-212.4746.92/jbr -Djps.fallback.jdk.version=11.0.11 -Dio.netty.noUnsafe=true -Djava.io.tmpdir=/home/pm/.cache/JetBrains/IntelliJIdea2021.2/compile-server/rfg-survey-api_cc70fc05/_temp_ -Djps.backward.ref.index.builder=true -Djps.track.ap.dependencies=false --add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED --add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED --add-opens=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED --add-opens=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED --add-opens=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED --add-opens=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED --add-opens=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED --add-opens=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED --add-opens=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-opens=jdk.compiler/com.sun.tools.javac.jvm=ALL-UNNAMED -Dtmh.instrument.annotations=true -Dtmh.generate.line.numbers=true -Dkotlin.incremental.compilation=true -Dkotlin.incremental.compilation.js=true -Dkotlin.daemon.enabled -Dkotlin.daemon.client.alive.path=\"/tmp/kotlin-idea-12426594439704512301-is-running\" -classpath /home/pm/idea-IU-212.4746.92/plugins/java/lib/jps-launcher.jar:/usr/lib/jvm/java-1.8.0-openjdk-amd64/lib/tools.jar org.jetbrains.jps.cmdline.Launcher /home/pm/idea-IU-212.4746.92/lib/slf4j.jar:/home/pm/idea-IU-212.4746.92/lib/idea_rt.jar:/home/pm/idea-IU-212.4746.92/lib/platform-api.jar:/home/pm/idea-IU-212.4746.92/plugins/java/lib/maven-resolver-transport-file-1.3.3.jar:/home/pm/idea-IU-212.4746.92/lib/forms_rt.jar:/home/pm/idea-IU-212.4746.92/lib/util.jar:/home/pm/idea-IU-212.4746.92/lib/annotations.jar:/home/pm/idea-IU-212.4746.92/lib/3rd-party.jar:/home/pm/idea-IU-212.4746.92/lib/kotlin-stdlib-jdk8.jar:/home/pm/idea-IU-212.4746.92/plugins/java/lib/maven-resolver-connector-basic-1.3.3.jar:/home/pm/idea-IU-212.4746.92/lib/jna-platform.jar:/home/pm/idea-IU-212.4746.92/lib/protobuf-java-3.15.8.jar:/home/pm/idea-IU-212.4746.92/plugins/java/lib/jps-builders-6.jar:/home/pm/idea-IU-212.4746.92/plugins/java/lib/javac2.jar:/home/pm/idea-IU-212.4746.92/plugins/java/lib/aether-dependency-resolver.jar:/home/pm/idea-IU-212.4746.92/plugins/java/lib/jps-builders.jar:/home/pm/idea-IU-212.4746.92/plugins/java/lib/jps-javac-extension-1.jar:/home/pm/idea-IU-212.4746.92/lib/jna.jar:/home/pm/idea-IU-212.4746.92/lib/jps-model.jar:/home/pm/idea-IU-212.4746.92/plugins/java/lib/maven-resolver-transport-http-1.3.3.jar:/home/pm/idea-IU-212.4746.92/plugins/JavaEE/lib/jasper-v2-rt.jar:/home/pm/idea-IU-212.4746.92/plugins/Kotlin/lib/kotlin-reflect.jar:/home/pm/idea-IU-212.4746.92/plugins/Kotlin/lib/kotlin-plugin.jar:/home/pm/idea-IU-212.4746.92/plugins/ant/lib/ant-jps.jar:/home/pm/idea-IU-212.4746.92/plugins/uiDesigner/lib/jps/java-guiForms-jps.jar:/home/pm/idea-IU-212.4746.92/plugins/eclipse/lib/eclipse-jps.jar:/home/pm/idea-IU-212.4746.92/plugins/eclipse/lib/eclipse-common.jar:/home/pm/idea-IU-212.4746.92/plugins/IntelliLang/lib/java-langInjection-jps.jar:/home/pm/idea-IU-212.4746.92/plugins/Groovy/lib/groovy-jps.jar:/home/pm/idea-IU-212.4746.92/plugins/Groovy/lib/groovy-constants-rt.jar:/home/pm/idea-IU-212.4746.92/plugins/maven/lib/maven-jps.jar:/home/pm/idea-IU-212.4746.92/plugins/gradle-java/lib/gradle-jps.jar:/home/pm/idea-IU-212.4746.92/plugins/devkit/lib/devkit-jps.jar:/home/pm/idea-IU-212.4746.92/plugins/javaFX/lib/javaFX-jps.jar:/home/pm/idea-IU-212.4746.92/plugins/javaFX/lib/javaFX-common.jar:/home/pm/idea-IU-212.4746.92/plugins/JavaEE/lib/javaee-jps.jar:/home/pm/idea-IU-212.4746.92/plugins/webSphereIntegration/lib/jps/javaee-appServers-websphere-jps.jar:/home/pm/idea-IU-212.4746.92/plugins/weblogicIntegration/lib/jps/javaee-appServers-weblogic-jps.jar:/home/pm/idea-IU-212.4746.92/plugins/JPA/lib/jps/javaee-jpa-jps.jar:/home/pm/idea-IU-212.4746.92/plugins/Grails/lib/groovy-grails-jps.jar:/home/pm/idea-IU-212.4746.92/plugins/Grails/lib/groovy-grails-compilerPatch.jar:/home/pm/idea-IU-212.4746.92/plugins/Kotlin/lib/jps/kotlin-jps-plugin.jar:/home/pm/idea-IU-212.4746.92/plugins/Kotlin/lib/kotlin-jps-common.jar:/home/pm/idea-IU-212.4746.92/plugins/Kotlin/lib/kotlin-common.jar org.jetbrains.jps.cmdline.BuildMain 127.0.0.1 34781 9f0681bb-da2a-48db-8344-900ddeb29804 /home/pm/.cache/JetBrains/IntelliJIdea2021.2/compile-server
16Unrecognized option: --add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED
17Error: Could not create the Java Virtual Machine.
18Error: A fatal exception has occurred. Program will exit.
19

I found other comment to check Lombok works and I see it is fine.

How to fix the problem?

ANSWER

Answered 2021-Jul-28 at 07:22

You are running the project via Java 1.8 and add the --add-opens option to the runner. However Java 1.8 does not support it.

So, the first option is to use Java 11 to run the project, as Java 11 can recognize this VM option.

Another solution is to find a place where --add-opens is added and remove it. Check Run configuration in IntelliJ IDEA (VM options field) and Maven/Gradle configuration files for argLine (Maven) and jvmArgs (Gradle)

Source https://stackoverflow.com/questions/68554693

QUESTION

Error while downloading the requirements using pip install (setup command: use_2to3 is invalid.)

Asked 2022-Mar-05 at 07:13

version pip 21.2.4 python 3.6

The command:

1pip install -r  requirments.txt
2

The content of my requirements.txt:

1pip install -r  requirments.txt
2mongoengine==0.19.1
3numpy==1.16.2
4pylint
5pandas==1.1.5
6fawkes
7

The command is failing with this error

1pip install -r  requirments.txt
2mongoengine==0.19.1
3numpy==1.16.2
4pylint
5pandas==1.1.5
6fawkes
7ERROR: Command errored out with exit status 1:
8     command: /Users/*/Desktop/ml/*/venv/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/kn/0y92g7x55qs7c42tln4gwhtm0000gp/T/pip-install-soh30mel/mongoengine_89e68f8427244f1bb3215b22f77a619c/setup.py'"'"'; __file__='"'"'/private/var/folders/kn/0y92g7x55qs7c42tln4gwhtm0000gp/T/pip-install-soh30mel/mongoengine_89e68f8427244f1bb3215b22f77a619c/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/kn/0y92g7x55qs7c42tln4gwhtm0000gp/T/pip-pip-egg-info-97994d6e
9         cwd: /private/var/folders/kn/0y92g7x55qs7c42tln4gwhtm0000gp/T/pip-install-soh30mel/mongoengine_89e68f8427244f1bb3215b22f77a619c/
10    Complete output (1 lines):
11    error in mongoengine setup command: use_2to3 is invalid.
12    ----------------------------------------
13WARNING: Discarding https://*/pypi/packages/mongoengine-0.19.1.tar.gz#md5=68e613009f6466239158821a102ac084 (from https://*/pypi/simple/mongoengine/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
14ERROR: Could not find a version that satisfies the requirement mongoengine==0.19.1 (from versions: 0.15.0, 0.19.1)
15ERROR: No matching distribution found for mongoengine==0.19.1
16

ANSWER

Answered 2021-Nov-19 at 13:30

It looks like setuptools>=58 breaks support for use_2to3:

setuptools changelog for v58

So you should update setuptools to setuptools<58 or avoid using packages with use_2to3 in the setup parameters.

I was having the same problem, pip==19.3.1

Source https://stackoverflow.com/questions/69100275

QUESTION

WARNING: Running pip as the 'root' user

Asked 2022-Feb-24 at 01:59

I am making simple image of my python Django app in Docker. But at the end of the building container it throws next warning (I am building it on Ubuntu 20.04):

1WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead
2

Why does it throw this warning if I am installing Python requirements inside my image? I am building my image using:

1WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead
2sudo docker build -t my_app:1 .
3

Should I be worried about warning that pip throws, because I know it can break my system?

Here is my Dockerfile:

1WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead
2sudo docker build -t my_app:1 .
3FROM python:3.8-slim-buster
4
5WORKDIR /app
6
7COPY requirements.txt requirements.txt
8
9RUN pip install -r requirements.txt
10
11COPY . .
12
13CMD [&quot;python&quot;, &quot;manage.py&quot;, &quot;runserver&quot;, &quot;0.0.0.0:8000&quot;]
14

ANSWER

Answered 2021-Aug-29 at 08:12

The way your container is built doesn't add a user, so everything is done as root.

You could create a user and install to that users's home directory by doing something like this;

1WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead
2sudo docker build -t my_app:1 .
3FROM python:3.8-slim-buster
4
5WORKDIR /app
6
7COPY requirements.txt requirements.txt
8
9RUN pip install -r requirements.txt
10
11COPY . .
12
13CMD [&quot;python&quot;, &quot;manage.py&quot;, &quot;runserver&quot;, &quot;0.0.0.0:8000&quot;]
14FROM python:3.8.3-alpine
15
16RUN pip install --upgrade pip
17
18RUN adduser -D myuser
19USER myuser
20WORKDIR /home/myuser
21
22COPY --chown=myuser:myuser requirements.txt requirements.txt
23RUN pip install --user -r requirements.txt
24
25ENV PATH=&quot;/home/myuser/.local/bin:${PATH}&quot;
26
27COPY --chown=myuser:myuser . .
28
29CMD [&quot;python&quot;, &quot;manage.py&quot;, &quot;runserver&quot;, &quot;0.0.0.0:8000&quot;]
30

Source https://stackoverflow.com/questions/68673221

QUESTION

android:exported needs to be explicitly specified for &lt;activity&gt;. Apps targeting Android 12 and higher are required to specify

Asked 2022-Feb-23 at 14:13

After upgrading to android 12, the application is not compiling. It shows

"Manifest merger failed with multiple errors, see logs"

Error showing in Merged manifest:

Merging Errors: Error: android:exported needs to be explicitly specified for . Apps targeting Android 12 and higher are required to specify an explicit value for android:exported when the corresponding component has an intent filter defined. See https://developer.android.com/guide/topics/manifest/activity-element#exported for details. main manifest (this file)

I have set all the activity with android:exported="false". But it is still showing this issue.

My manifest file:

1&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
2&lt;manifest xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
3    xmlns:tools=&quot;http://schemas.android.com/tools&quot;
4    package=&quot;eu.siacs.conversations&quot;&gt;
5
6    &lt;uses-sdk tools:overrideLibrary=&quot;net.ypresto.androidtranscoder&quot; /&gt;
7
8    &lt;uses-permission android:name=&quot;android.permission.WRITE_EXTERNAL_STORAGE&quot; /&gt;
9    &lt;uses-permission android:name=&quot;android.permission.READ_EXTERNAL_STORAGE&quot; /&gt;
10    &lt;uses-permission android:name=&quot;android.permission.READ_CONTACTS&quot; /&gt;
11    &lt;uses-permission android:name=&quot;android.permission.READ_PROFILE&quot; /&gt;
12    &lt;uses-permission
13        android:name=&quot;android.permission.READ_PHONE_STATE&quot;
14        android:maxSdkVersion=&quot;22&quot; /&gt;
15    &lt;uses-permission android:name=&quot;android.permission.INTERNET&quot; /&gt;
16    &lt;uses-permission android:name=&quot;android.permission.ACCESS_NETWORK_STATE&quot; /&gt;
17    &lt;uses-permission android:name=&quot;android.permission.WAKE_LOCK&quot; /&gt;
18    &lt;uses-permission android:name=&quot;android.permission.RECEIVE_BOOT_COMPLETED&quot; /&gt;
19    &lt;uses-permission android:name=&quot;android.permission.VIBRATE&quot; /&gt;
20    &lt;uses-permission android:name=&quot;android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS&quot; /&gt;
21    &lt;uses-permission android:name=&quot;android.permission.ACCESS_COARSE_LOCATION&quot; /&gt;
22    &lt;uses-permission android:name=&quot;android.permission.ACCESS_FINE_LOCATION&quot; /&gt;
23    &lt;uses-permission android:name=&quot;android.permission.ACCESS_WIFI_STATE&quot; /&gt;
24    &lt;uses-permission android:name=&quot;android.permission.FOREGROUND_SERVICE&quot; /&gt;
25    &lt;uses-permission android:name=&quot;android.permission.REQUEST_INSTALL_PACKAGES&quot; /&gt;
26
27    &lt;uses-feature
28        android:name=&quot;android.hardware.location&quot;
29        android:required=&quot;false&quot; /&gt;
30    &lt;uses-feature
31        android:name=&quot;android.hardware.location.gps&quot;
32        android:required=&quot;false&quot; /&gt;
33    &lt;uses-feature
34        android:name=&quot;android.hardware.location.network&quot;
35        android:required=&quot;false&quot; /&gt;
36
37    &lt;uses-permission android:name=&quot;android.permission.CAMERA&quot; /&gt;
38    &lt;uses-permission android:name=&quot;android.permission.RECORD_AUDIO&quot; /&gt;
39    &lt;uses-permission android:name=&quot;android.permission.BLUETOOTH&quot; /&gt;
40    &lt;uses-permission android:name=&quot;android.permission.MODIFY_AUDIO_SETTINGS&quot; /&gt;
41    &lt;uses-permission android:name=&quot;android.permission.USE_FULL_SCREEN_INTENT&quot; /&gt;
42    &lt;uses-permission android:name=&quot;android.permission.SYSTEM_ALERT_WINDOW&quot; /&gt;
43
44    &lt;uses-feature
45        android:name=&quot;android.hardware.camera&quot;
46        android:required=&quot;false&quot; /&gt;
47    &lt;uses-feature
48        android:name=&quot;android.hardware.camera.autofocus&quot;
49        android:required=&quot;false&quot; /&gt;
50    &lt;uses-feature
51        android:name=&quot;android.hardware.microphone&quot;
52        android:required=&quot;false&quot; /&gt;
53
54    &lt;application
55        android:name=&quot;.Application&quot;
56        android:allowBackup=&quot;false&quot;
57        android:allowClearUserData=&quot;true&quot;
58        android:appCategory=&quot;social&quot;
59        android:hardwareAccelerated=&quot;true&quot;
60        android:icon=&quot;@mipmap/ic_app_launch&quot;
61        android:label=&quot;@string/app_name&quot;
62        android:largeHeap=&quot;true&quot;
63        android:networkSecurityConfig=&quot;@xml/network_security_configuration&quot;
64        android:requestLegacyExternalStorage=&quot;true&quot;
65        android:roundIcon=&quot;@mipmap/ic_app_launch_round&quot;
66        android:theme=&quot;@style/ConversationsTheme&quot;
67        android:usesCleartextTraffic=&quot;true&quot;
68        android:windowSoftInputMode=&quot;adjustPan|adjustResize&quot;
69        tools:replace=&quot;android:label&quot;
70        tools:targetApi=&quot;q&quot;&gt;
71        &lt;activity
72            android:name=&quot;.ui.search.GroupSearchActivity&quot;
73            android:exported=&quot;true&quot; /&gt;
74        &lt;activity
75            android:name=&quot;.ui.profileUpdating.FavouritesActivity&quot;
76            android:exported=&quot;true&quot; /&gt;
77        &lt;activity
78            android:name=&quot;.ui.profileUpdating.NameActivity&quot;
79            android:exported=&quot;true&quot; /&gt;
80        &lt;activity
81            android:name=&quot;.ui.CompulsoryUpdateActivity&quot;
82            android:exported=&quot;true&quot; /&gt;
83        &lt;activity android:name=&quot;.ui.payments.doPayment.DoPaymentActivity&quot;
84            android:exported=&quot;true&quot; /&gt;
85        &lt;activity android:name=&quot;.ui.individualList.IndividualListActivity&quot;
86            android:exported=&quot;true&quot; /&gt;
87        &lt;activity android:name=&quot;.ui.payments.setPayment.SetPaymentActivity&quot;
88            android:exported=&quot;true&quot; /&gt;
89        &lt;activity android:name=&quot;.ui.login.otpActivity.OTPActivity&quot;
90            android:exported=&quot;true&quot; /&gt;
91        &lt;activity android:name=&quot;.ui.login.loginActivity.LoginActivity&quot;
92            android:exported=&quot;true&quot; /&gt;
93
94        &lt;service android:name=&quot;.services.XmppConnectionService&quot; android:exported=&quot;true&quot; /&gt;
95
96        &lt;receiver android:name=&quot;.services.EventReceiver&quot;
97            android:exported=&quot;true&quot;&gt;
98            &lt;intent-filter&gt;
99                &lt;action android:name=&quot;android.intent.action.BOOT_COMPLETED&quot; /&gt;
100                &lt;action android:name=&quot;android.net.conn.CONNECTIVITY_CHANGE&quot; /&gt;
101                &lt;action android:name=&quot;android.intent.action.ACTION_SHUTDOWN&quot; /&gt;
102                &lt;action android:name=&quot;android.media.RINGER_MODE_CHANGED&quot; /&gt;
103            &lt;/intent-filter&gt;
104        &lt;/receiver&gt;
105
106        &lt;activity
107            android:name=&quot;.ui.ShareLocationActivity&quot;
108            android:label=&quot;@string/title_activity_share_location&quot;
109            android:exported=&quot;true&quot;/&gt;
110        &lt;activity
111            android:name=&quot;.ui.SearchActivity&quot;
112            android:label=&quot;@string/search_messages&quot;
113            android:exported=&quot;true&quot; /&gt;
114        &lt;activity
115            android:name=&quot;.ui.RecordingActivity&quot;
116            android:configChanges=&quot;orientation|screenSize&quot;
117            android:theme=&quot;@style/ConversationsTheme.Dialog&quot;
118            android:exported=&quot;true&quot; /&gt;
119        &lt;activity
120            android:name=&quot;.ui.ShowLocationActivity&quot;
121            android:label=&quot;@string/title_activity_show_location&quot;
122            android:exported=&quot;true&quot; /&gt;
123        &lt;activity
124            android:name=&quot;.ui.SplashActivity&quot;
125            android:theme=&quot;@style/SplashTheme&quot;
126            android:exported=&quot;true&quot;&gt;
127            &lt;intent-filter&gt;
128                &lt;action android:name=&quot;android.intent.action.MAIN&quot; /&gt;
129
130                &lt;category android:name=&quot;android.intent.category.LAUNCHER&quot; /&gt;
131            &lt;/intent-filter&gt;
132        &lt;/activity&gt;
133        &lt;activity
134            android:name=&quot;.ui.ConversationsActivity&quot;
135            android:label=&quot;@string/app_name&quot;
136            android:launchMode=&quot;singleTask&quot;
137            android:minWidth=&quot;300dp&quot;
138            android:minHeight=&quot;300dp&quot;
139            android:exported=&quot;true&quot;
140            android:windowSoftInputMode=&quot;stateHidden&quot; /&gt;
141        &lt;activity
142            android:name=&quot;.ui.ScanActivity&quot;
143            android:screenOrientation=&quot;portrait&quot;
144            android:exported=&quot;true&quot;
145            android:theme=&quot;@style/ConversationsTheme.FullScreen&quot;
146            android:windowSoftInputMode=&quot;stateAlwaysHidden&quot; /&gt;
147        &lt;activity
148            android:name=&quot;.ui.UriHandlerActivity&quot;
149            android:label=&quot;@string/app_name&quot;
150            android:exported=&quot;true&quot;&gt;
151            &lt;intent-filter&gt;
152                &lt;action android:name=&quot;android.intent.action.VIEW&quot; /&gt;
153
154                &lt;category android:name=&quot;android.intent.category.DEFAULT&quot; /&gt;
155                &lt;category android:name=&quot;android.intent.category.BROWSABLE&quot; /&gt;
156
157                &lt;data android:scheme=&quot;xmpp&quot; /&gt;
158            &lt;/intent-filter&gt;
159            &lt;intent-filter android:autoVerify=&quot;true&quot;&gt;
160                &lt;action android:name=&quot;android.intent.action.VIEW&quot; /&gt;
161
162                &lt;category android:name=&quot;android.intent.category.DEFAULT&quot; /&gt;
163                &lt;category android:name=&quot;android.intent.category.BROWSABLE&quot; /&gt;
164
165                &lt;data android:scheme=&quot;https&quot; /&gt;
166                &lt;data android:host=&quot;im.app.in&quot; /&gt;
167                &lt;data android:pathPrefix=&quot;/i/&quot; /&gt;
168                &lt;data android:pathPrefix=&quot;/j/&quot; /&gt;
169            &lt;/intent-filter&gt;
170            &lt;intent-filter&gt;
171                &lt;action android:name=&quot;android.intent.action.SENDTO&quot; /&gt;
172
173                &lt;category android:name=&quot;android.intent.category.DEFAULT&quot; /&gt;
174
175                &lt;data android:scheme=&quot;imto&quot; /&gt;
176                &lt;data android:host=&quot;jabber&quot; /&gt;
177            &lt;/intent-filter&gt;
178        &lt;/activity&gt;
179        &lt;activity
180            android:name=&quot;.ui.StartConversationActivity&quot;
181            android:label=&quot;@string/title_activity_start_conversation&quot;
182            android:launchMode=&quot;singleTop&quot;
183            android:exported=&quot;true&quot;&gt;
184            &lt;intent-filter&gt;
185                &lt;action android:name=&quot;android.intent.action.VIEW&quot; /&gt;
186            &lt;/intent-filter&gt;
187        &lt;/activity&gt;
188        &lt;activity
189            android:name=&quot;.ui.SettingsActivity&quot;
190            android:label=&quot;@string/title_activity_settings&quot;
191            android:exported=&quot;true&quot;&gt;
192            &lt;intent-filter&gt;
193                &lt;action android:name=&quot;android.intent.action.MAIN&quot; /&gt;
194
195                &lt;category android:name=&quot;android.intent.category.NOTIFICATION_PREFERENCES&quot; /&gt;
196            &lt;/intent-filter&gt;
197        &lt;/activity&gt;
198        &lt;activity
199            android:name=&quot;.ui.ChooseContactActivity&quot;
200            android:label=&quot;@string/title_activity_choose_contact&quot;
201            android:exported=&quot;true&quot; /&gt;
202        &lt;activity
203            android:name=&quot;.ui.BlocklistActivity&quot;
204            android:label=&quot;@string/title_activity_block_list&quot;
205            android:exported=&quot;true&quot;/&gt;
206        &lt;activity
207            android:name=&quot;.ui.ChangePasswordActivity&quot;
208            android:label=&quot;@string/change_password_on_server&quot;
209            android:exported=&quot;true&quot;/&gt;
210        &lt;activity
211            android:name=&quot;.ui.ChooseAccountForProfilePictureActivity&quot;
212            android:enabled=&quot;false&quot;
213            android:label=&quot;@string/choose_account&quot;
214            android:exported=&quot;true&quot;&gt;
215            &lt;intent-filter android:label=&quot;@string/set_profile_picture&quot;&gt;
216                &lt;action android:name=&quot;android.intent.action.ATTACH_DATA&quot; /&gt;
217
218                &lt;category android:name=&quot;android.intent.category.DEFAULT&quot; /&gt;
219
220                &lt;data android:mimeType=&quot;image/*&quot; /&gt;
221            &lt;/intent-filter&gt;
222        &lt;/activity&gt;
223        &lt;activity
224            android:name=&quot;.ui.ShareViaAccountActivity&quot;
225            android:label=&quot;@string/title_activity_share_via_account&quot;
226            android:launchMode=&quot;singleTop&quot;
227            android:exported=&quot;true&quot; /&gt;
228        &lt;activity
229            android:name=&quot;.ui.EditAccountActivity&quot;
230            android:launchMode=&quot;singleTop&quot;
231            android:exported=&quot;true&quot;
232            android:windowSoftInputMode=&quot;stateHidden|adjustResize&quot; /&gt;
233        &lt;activity
234            android:name=&quot;.ui.ConferenceDetailsActivity&quot;
235            android:label=&quot;@string/action_muc_details&quot;
236            android:exported=&quot;true&quot;
237            android:windowSoftInputMode=&quot;stateHidden&quot; /&gt;
238        &lt;activity
239            android:name=&quot;.ui.ContactDetailsActivity&quot;
240            android:exported=&quot;true&quot;
241            android:windowSoftInputMode=&quot;stateHidden&quot; /&gt;
242        &lt;activity
243            android:name=&quot;.ui.PublishProfilePictureActivity&quot;
244            android:label=&quot;@string/mgmt_account_publish_avatar&quot;
245            android:exported=&quot;true&quot;
246            android:windowSoftInputMode=&quot;stateHidden&quot; /&gt;
247        &lt;activity
248            android:name=&quot;.ui.PublishGroupChatProfilePictureActivity&quot;
249            android:exported=&quot;true&quot;
250            android:label=&quot;@string/group_chat_avatar&quot; /&gt;
251        &lt;activity
252            android:name=&quot;.ui.ShareWithActivity&quot;
253            android:label=&quot;@string/app_name&quot;
254            android:launchMode=&quot;singleTop&quot;
255            android:exported=&quot;true&quot;&gt;
256            &lt;intent-filter&gt;
257                &lt;action android:name=&quot;android.intent.action.SEND&quot; /&gt;
258                &lt;action android:name=&quot;android.intent.action.SEND_MULTIPLE&quot; /&gt;
259
260                &lt;category android:name=&quot;android.intent.category.DEFAULT&quot; /&gt;
261
262                &lt;data android:mimeType=&quot;text/plain&quot; /&gt;
263            &lt;/intent-filter&gt;
264            &lt;intent-filter&gt;
265                &lt;action android:name=&quot;android.intent.action.SEND&quot; /&gt;
266                &lt;action android:name=&quot;android.intent.action.SEND_MULTIPLE&quot; /&gt;
267
268                &lt;category android:name=&quot;android.intent.category.DEFAULT&quot; /&gt;
269
270                &lt;data android:mimeType=&quot;*/*&quot; /&gt;
271            &lt;/intent-filter&gt;
272
273            &lt;!-- the value here needs to be the full class name; independent of the configured applicationId --&gt;
274            &lt;meta-data
275                android:name=&quot;android.service.chooser.chooser_target_service&quot;
276                android:value=&quot;eu.siacs.conversations.services.ContactChooserTargetService&quot; /&gt;
277        &lt;/activity&gt;
278        &lt;activity
279            android:name=&quot;.ui.TrustKeysActivity&quot;
280            android:label=&quot;@string/trust_omemo_fingerprints&quot;
281            android:exported=&quot;true&quot;
282            android:windowSoftInputMode=&quot;stateAlwaysHidden&quot; /&gt;
283        &lt;activity
284            android:name=&quot;com.theartofdev.edmodo.cropper.CropImageActivity&quot;
285            android:exported=&quot;true&quot;
286            android:theme=&quot;@style/Base.Theme.AppCompat&quot; /&gt;
287        &lt;activity android:name=&quot;.ui.MemorizingActivity&quot;
288            android:exported=&quot;true&quot; /&gt;
289        &lt;activity
290            android:name=&quot;.ui.MediaBrowserActivity&quot;
291            android:exported=&quot;true&quot;
292            android:label=&quot;@string/media_browser&quot; /&gt;
293
294        &lt;service android:name=&quot;.services.ExportBackupService&quot; android:exported=&quot;true&quot;/&gt;
295        &lt;service android:name=&quot;.services.ImportBackupService&quot; android:exported=&quot;true&quot;/&gt;
296        &lt;service
297            android:name=&quot;.services.ContactChooserTargetService&quot;
298            android:permission=&quot;android.permission.BIND_CHOOSER_TARGET_SERVICE&quot;
299            android:exported=&quot;true&quot;&gt;
300            &lt;intent-filter&gt;
301                &lt;action android:name=&quot;android.service.chooser.ChooserTargetService&quot; /&gt;
302            &lt;/intent-filter&gt;
303        &lt;/service&gt;
304        &lt;service android:name=&quot;.services.CompulsoryUpdateService&quot; android:exported=&quot;true&quot;/&gt;
305
306        &lt;provider
307            android:name=&quot;androidx.core.content.FileProvider&quot;
308            android:authorities=&quot;${applicationId}.files&quot;
309            android:exported=&quot;false&quot;
310            android:grantUriPermissions=&quot;true&quot;&gt;
311            &lt;meta-data
312                android:name=&quot;android.support.FILE_PROVIDER_PATHS&quot;
313                android:resource=&quot;@xml/file_paths&quot; /&gt;
314        &lt;/provider&gt;
315        &lt;provider
316            android:name=&quot;.services.BarcodeProvider&quot;
317            android:authorities=&quot;${applicationId}.barcodes&quot;
318            android:exported=&quot;false&quot;
319            android:grantUriPermissions=&quot;true&quot; /&gt;
320
321        &lt;activity
322            android:name=&quot;.ui.ShortcutActivity&quot;
323            android:label=&quot;@string/contact&quot;
324            android:exported=&quot;true&quot;&gt;
325            &lt;intent-filter&gt;
326                &lt;action android:name=&quot;android.intent.action.CREATE_SHORTCUT&quot; /&gt;
327            &lt;/intent-filter&gt;
328        &lt;/activity&gt;
329        &lt;activity
330            android:name=&quot;.ui.MucUsersActivity&quot;
331            android:exported=&quot;true&quot;
332            android:label=&quot;@string/group_chat_members&quot; /&gt;
333        &lt;activity
334            android:name=&quot;.ui.ChannelDiscoveryActivity&quot;
335            android:exported=&quot;true&quot;
336            android:label=&quot;@string/discover_channels&quot; /&gt;
337        &lt;activity
338            android:name=&quot;.ui.RtpSessionActivity&quot;
339            android:autoRemoveFromRecents=&quot;true&quot;
340            android:exported=&quot;true&quot;
341            android:launchMode=&quot;singleInstance&quot;
342            android:supportsPictureInPicture=&quot;true&quot; /&gt;
343    &lt;/application&gt;
344
345&lt;/manifest&gt;
346

My second manifest file:

1&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
2&lt;manifest xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
3    xmlns:tools=&quot;http://schemas.android.com/tools&quot;
4    package=&quot;eu.siacs.conversations&quot;&gt;
5
6    &lt;uses-sdk tools:overrideLibrary=&quot;net.ypresto.androidtranscoder&quot; /&gt;
7
8    &lt;uses-permission android:name=&quot;android.permission.WRITE_EXTERNAL_STORAGE&quot; /&gt;
9    &lt;uses-permission android:name=&quot;android.permission.READ_EXTERNAL_STORAGE&quot; /&gt;
10    &lt;uses-permission android:name=&quot;android.permission.READ_CONTACTS&quot; /&gt;
11    &lt;uses-permission android:name=&quot;android.permission.READ_PROFILE&quot; /&gt;
12    &lt;uses-permission
13        android:name=&quot;android.permission.READ_PHONE_STATE&quot;
14        android:maxSdkVersion=&quot;22&quot; /&gt;
15    &lt;uses-permission android:name=&quot;android.permission.INTERNET&quot; /&gt;
16    &lt;uses-permission android:name=&quot;android.permission.ACCESS_NETWORK_STATE&quot; /&gt;
17    &lt;uses-permission android:name=&quot;android.permission.WAKE_LOCK&quot; /&gt;
18    &lt;uses-permission android:name=&quot;android.permission.RECEIVE_BOOT_COMPLETED&quot; /&gt;
19    &lt;uses-permission android:name=&quot;android.permission.VIBRATE&quot; /&gt;
20    &lt;uses-permission android:name=&quot;android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS&quot; /&gt;
21    &lt;uses-permission android:name=&quot;android.permission.ACCESS_COARSE_LOCATION&quot; /&gt;
22    &lt;uses-permission android:name=&quot;android.permission.ACCESS_FINE_LOCATION&quot; /&gt;
23    &lt;uses-permission android:name=&quot;android.permission.ACCESS_WIFI_STATE&quot; /&gt;
24    &lt;uses-permission android:name=&quot;android.permission.FOREGROUND_SERVICE&quot; /&gt;
25    &lt;uses-permission android:name=&quot;android.permission.REQUEST_INSTALL_PACKAGES&quot; /&gt;
26
27    &lt;uses-feature
28        android:name=&quot;android.hardware.location&quot;
29        android:required=&quot;false&quot; /&gt;
30    &lt;uses-feature
31        android:name=&quot;android.hardware.location.gps&quot;
32        android:required=&quot;false&quot; /&gt;
33    &lt;uses-feature
34        android:name=&quot;android.hardware.location.network&quot;
35        android:required=&quot;false&quot; /&gt;
36
37    &lt;uses-permission android:name=&quot;android.permission.CAMERA&quot; /&gt;
38    &lt;uses-permission android:name=&quot;android.permission.RECORD_AUDIO&quot; /&gt;
39    &lt;uses-permission android:name=&quot;android.permission.BLUETOOTH&quot; /&gt;
40    &lt;uses-permission android:name=&quot;android.permission.MODIFY_AUDIO_SETTINGS&quot; /&gt;
41    &lt;uses-permission android:name=&quot;android.permission.USE_FULL_SCREEN_INTENT&quot; /&gt;
42    &lt;uses-permission android:name=&quot;android.permission.SYSTEM_ALERT_WINDOW&quot; /&gt;
43
44    &lt;uses-feature
45        android:name=&quot;android.hardware.camera&quot;
46        android:required=&quot;false&quot; /&gt;
47    &lt;uses-feature
48        android:name=&quot;android.hardware.camera.autofocus&quot;
49        android:required=&quot;false&quot; /&gt;
50    &lt;uses-feature
51        android:name=&quot;android.hardware.microphone&quot;
52        android:required=&quot;false&quot; /&gt;
53
54    &lt;application
55        android:name=&quot;.Application&quot;
56        android:allowBackup=&quot;false&quot;
57        android:allowClearUserData=&quot;true&quot;
58        android:appCategory=&quot;social&quot;
59        android:hardwareAccelerated=&quot;true&quot;
60        android:icon=&quot;@mipmap/ic_app_launch&quot;
61        android:label=&quot;@string/app_name&quot;
62        android:largeHeap=&quot;true&quot;
63        android:networkSecurityConfig=&quot;@xml/network_security_configuration&quot;
64        android:requestLegacyExternalStorage=&quot;true&quot;
65        android:roundIcon=&quot;@mipmap/ic_app_launch_round&quot;
66        android:theme=&quot;@style/ConversationsTheme&quot;
67        android:usesCleartextTraffic=&quot;true&quot;
68        android:windowSoftInputMode=&quot;adjustPan|adjustResize&quot;
69        tools:replace=&quot;android:label&quot;
70        tools:targetApi=&quot;q&quot;&gt;
71        &lt;activity
72            android:name=&quot;.ui.search.GroupSearchActivity&quot;
73            android:exported=&quot;true&quot; /&gt;
74        &lt;activity
75            android:name=&quot;.ui.profileUpdating.FavouritesActivity&quot;
76            android:exported=&quot;true&quot; /&gt;
77        &lt;activity
78            android:name=&quot;.ui.profileUpdating.NameActivity&quot;
79            android:exported=&quot;true&quot; /&gt;
80        &lt;activity
81            android:name=&quot;.ui.CompulsoryUpdateActivity&quot;
82            android:exported=&quot;true&quot; /&gt;
83        &lt;activity android:name=&quot;.ui.payments.doPayment.DoPaymentActivity&quot;
84            android:exported=&quot;true&quot; /&gt;
85        &lt;activity android:name=&quot;.ui.individualList.IndividualListActivity&quot;
86            android:exported=&quot;true&quot; /&gt;
87        &lt;activity android:name=&quot;.ui.payments.setPayment.SetPaymentActivity&quot;
88            android:exported=&quot;true&quot; /&gt;
89        &lt;activity android:name=&quot;.ui.login.otpActivity.OTPActivity&quot;
90            android:exported=&quot;true&quot; /&gt;
91        &lt;activity android:name=&quot;.ui.login.loginActivity.LoginActivity&quot;
92            android:exported=&quot;true&quot; /&gt;
93
94        &lt;service android:name=&quot;.services.XmppConnectionService&quot; android:exported=&quot;true&quot; /&gt;
95
96        &lt;receiver android:name=&quot;.services.EventReceiver&quot;
97            android:exported=&quot;true&quot;&gt;
98            &lt;intent-filter&gt;
99                &lt;action android:name=&quot;android.intent.action.BOOT_COMPLETED&quot; /&gt;
100                &lt;action android:name=&quot;android.net.conn.CONNECTIVITY_CHANGE&quot; /&gt;
101                &lt;action android:name=&quot;android.intent.action.ACTION_SHUTDOWN&quot; /&gt;
102                &lt;action android:name=&quot;android.media.RINGER_MODE_CHANGED&quot; /&gt;
103            &lt;/intent-filter&gt;
104        &lt;/receiver&gt;
105
106        &lt;activity
107            android:name=&quot;.ui.ShareLocationActivity&quot;
108            android:label=&quot;@string/title_activity_share_location&quot;
109            android:exported=&quot;true&quot;/&gt;
110        &lt;activity
111            android:name=&quot;.ui.SearchActivity&quot;
112            android:label=&quot;@string/search_messages&quot;
113            android:exported=&quot;true&quot; /&gt;
114        &lt;activity
115            android:name=&quot;.ui.RecordingActivity&quot;
116            android:configChanges=&quot;orientation|screenSize&quot;
117            android:theme=&quot;@style/ConversationsTheme.Dialog&quot;
118            android:exported=&quot;true&quot; /&gt;
119        &lt;activity
120            android:name=&quot;.ui.ShowLocationActivity&quot;
121            android:label=&quot;@string/title_activity_show_location&quot;
122            android:exported=&quot;true&quot; /&gt;
123        &lt;activity
124            android:name=&quot;.ui.SplashActivity&quot;
125            android:theme=&quot;@style/SplashTheme&quot;
126            android:exported=&quot;true&quot;&gt;
127            &lt;intent-filter&gt;
128                &lt;action android:name=&quot;android.intent.action.MAIN&quot; /&gt;
129
130                &lt;category android:name=&quot;android.intent.category.LAUNCHER&quot; /&gt;
131            &lt;/intent-filter&gt;
132        &lt;/activity&gt;
133        &lt;activity
134            android:name=&quot;.ui.ConversationsActivity&quot;
135            android:label=&quot;@string/app_name&quot;
136            android:launchMode=&quot;singleTask&quot;
137            android:minWidth=&quot;300dp&quot;
138            android:minHeight=&quot;300dp&quot;
139            android:exported=&quot;true&quot;
140            android:windowSoftInputMode=&quot;stateHidden&quot; /&gt;
141        &lt;activity
142            android:name=&quot;.ui.ScanActivity&quot;
143            android:screenOrientation=&quot;portrait&quot;
144            android:exported=&quot;true&quot;
145            android:theme=&quot;@style/ConversationsTheme.FullScreen&quot;
146            android:windowSoftInputMode=&quot;stateAlwaysHidden&quot; /&gt;
147        &lt;activity
148            android:name=&quot;.ui.UriHandlerActivity&quot;
149            android:label=&quot;@string/app_name&quot;
150            android:exported=&quot;true&quot;&gt;
151            &lt;intent-filter&gt;
152                &lt;action android:name=&quot;android.intent.action.VIEW&quot; /&gt;
153
154                &lt;category android:name=&quot;android.intent.category.DEFAULT&quot; /&gt;
155                &lt;category android:name=&quot;android.intent.category.BROWSABLE&quot; /&gt;
156
157                &lt;data android:scheme=&quot;xmpp&quot; /&gt;
158            &lt;/intent-filter&gt;
159            &lt;intent-filter android:autoVerify=&quot;true&quot;&gt;
160                &lt;action android:name=&quot;android.intent.action.VIEW&quot; /&gt;
161
162                &lt;category android:name=&quot;android.intent.category.DEFAULT&quot; /&gt;
163                &lt;category android:name=&quot;android.intent.category.BROWSABLE&quot; /&gt;
164
165                &lt;data android:scheme=&quot;https&quot; /&gt;
166                &lt;data android:host=&quot;im.app.in&quot; /&gt;
167                &lt;data android:pathPrefix=&quot;/i/&quot; /&gt;
168                &lt;data android:pathPrefix=&quot;/j/&quot; /&gt;
169            &lt;/intent-filter&gt;
170            &lt;intent-filter&gt;
171                &lt;action android:name=&quot;android.intent.action.SENDTO&quot; /&gt;
172
173                &lt;category android:name=&quot;android.intent.category.DEFAULT&quot; /&gt;
174
175                &lt;data android:scheme=&quot;imto&quot; /&gt;
176                &lt;data android:host=&quot;jabber&quot; /&gt;
177            &lt;/intent-filter&gt;
178        &lt;/activity&gt;
179        &lt;activity
180            android:name=&quot;.ui.StartConversationActivity&quot;
181            android:label=&quot;@string/title_activity_start_conversation&quot;
182            android:launchMode=&quot;singleTop&quot;
183            android:exported=&quot;true&quot;&gt;
184            &lt;intent-filter&gt;
185                &lt;action android:name=&quot;android.intent.action.VIEW&quot; /&gt;
186            &lt;/intent-filter&gt;
187        &lt;/activity&gt;
188        &lt;activity
189            android:name=&quot;.ui.SettingsActivity&quot;
190            android:label=&quot;@string/title_activity_settings&quot;
191            android:exported=&quot;true&quot;&gt;
192            &lt;intent-filter&gt;
193                &lt;action android:name=&quot;android.intent.action.MAIN&quot; /&gt;
194
195                &lt;category android:name=&quot;android.intent.category.NOTIFICATION_PREFERENCES&quot; /&gt;
196            &lt;/intent-filter&gt;
197        &lt;/activity&gt;
198        &lt;activity
199            android:name=&quot;.ui.ChooseContactActivity&quot;
200            android:label=&quot;@string/title_activity_choose_contact&quot;
201            android:exported=&quot;true&quot; /&gt;
202        &lt;activity
203            android:name=&quot;.ui.BlocklistActivity&quot;
204            android:label=&quot;@string/title_activity_block_list&quot;
205            android:exported=&quot;true&quot;/&gt;
206        &lt;activity
207            android:name=&quot;.ui.ChangePasswordActivity&quot;
208            android:label=&quot;@string/change_password_on_server&quot;
209            android:exported=&quot;true&quot;/&gt;
210        &lt;activity
211            android:name=&quot;.ui.ChooseAccountForProfilePictureActivity&quot;
212            android:enabled=&quot;false&quot;
213            android:label=&quot;@string/choose_account&quot;
214            android:exported=&quot;true&quot;&gt;
215            &lt;intent-filter android:label=&quot;@string/set_profile_picture&quot;&gt;
216                &lt;action android:name=&quot;android.intent.action.ATTACH_DATA&quot; /&gt;
217
218                &lt;category android:name=&quot;android.intent.category.DEFAULT&quot; /&gt;
219
220                &lt;data android:mimeType=&quot;image/*&quot; /&gt;
221            &lt;/intent-filter&gt;
222        &lt;/activity&gt;
223        &lt;activity
224            android:name=&quot;.ui.ShareViaAccountActivity&quot;
225            android:label=&quot;@string/title_activity_share_via_account&quot;
226            android:launchMode=&quot;singleTop&quot;
227            android:exported=&quot;true&quot; /&gt;
228        &lt;activity
229            android:name=&quot;.ui.EditAccountActivity&quot;
230            android:launchMode=&quot;singleTop&quot;
231            android:exported=&quot;true&quot;
232            android:windowSoftInputMode=&quot;stateHidden|adjustResize&quot; /&gt;
233        &lt;activity
234            android:name=&quot;.ui.ConferenceDetailsActivity&quot;
235            android:label=&quot;@string/action_muc_details&quot;
236            android:exported=&quot;true&quot;
237            android:windowSoftInputMode=&quot;stateHidden&quot; /&gt;
238        &lt;activity
239            android:name=&quot;.ui.ContactDetailsActivity&quot;
240            android:exported=&quot;true&quot;
241            android:windowSoftInputMode=&quot;stateHidden&quot; /&gt;
242        &lt;activity
243            android:name=&quot;.ui.PublishProfilePictureActivity&quot;
244            android:label=&quot;@string/mgmt_account_publish_avatar&quot;
245            android:exported=&quot;true&quot;
246            android:windowSoftInputMode=&quot;stateHidden&quot; /&gt;
247        &lt;activity
248            android:name=&quot;.ui.PublishGroupChatProfilePictureActivity&quot;
249            android:exported=&quot;true&quot;
250            android:label=&quot;@string/group_chat_avatar&quot; /&gt;
251        &lt;activity
252            android:name=&quot;.ui.ShareWithActivity&quot;
253            android:label=&quot;@string/app_name&quot;
254            android:launchMode=&quot;singleTop&quot;
255            android:exported=&quot;true&quot;&gt;
256            &lt;intent-filter&gt;
257                &lt;action android:name=&quot;android.intent.action.SEND&quot; /&gt;
258                &lt;action android:name=&quot;android.intent.action.SEND_MULTIPLE&quot; /&gt;
259
260                &lt;category android:name=&quot;android.intent.category.DEFAULT&quot; /&gt;
261
262                &lt;data android:mimeType=&quot;text/plain&quot; /&gt;
263            &lt;/intent-filter&gt;
264            &lt;intent-filter&gt;
265                &lt;action android:name=&quot;android.intent.action.SEND&quot; /&gt;
266                &lt;action android:name=&quot;android.intent.action.SEND_MULTIPLE&quot; /&gt;
267
268                &lt;category android:name=&quot;android.intent.category.DEFAULT&quot; /&gt;
269
270                &lt;data android:mimeType=&quot;*/*&quot; /&gt;
271            &lt;/intent-filter&gt;
272
273            &lt;!-- the value here needs to be the full class name; independent of the configured applicationId --&gt;
274            &lt;meta-data
275                android:name=&quot;android.service.chooser.chooser_target_service&quot;
276                android:value=&quot;eu.siacs.conversations.services.ContactChooserTargetService&quot; /&gt;
277        &lt;/activity&gt;
278        &lt;activity
279            android:name=&quot;.ui.TrustKeysActivity&quot;
280            android:label=&quot;@string/trust_omemo_fingerprints&quot;
281            android:exported=&quot;true&quot;
282            android:windowSoftInputMode=&quot;stateAlwaysHidden&quot; /&gt;
283        &lt;activity
284            android:name=&quot;com.theartofdev.edmodo.cropper.CropImageActivity&quot;
285            android:exported=&quot;true&quot;
286            android:theme=&quot;@style/Base.Theme.AppCompat&quot; /&gt;
287        &lt;activity android:name=&quot;.ui.MemorizingActivity&quot;
288            android:exported=&quot;true&quot; /&gt;
289        &lt;activity
290            android:name=&quot;.ui.MediaBrowserActivity&quot;
291            android:exported=&quot;true&quot;
292            android:label=&quot;@string/media_browser&quot; /&gt;
293
294        &lt;service android:name=&quot;.services.ExportBackupService&quot; android:exported=&quot;true&quot;/&gt;
295        &lt;service android:name=&quot;.services.ImportBackupService&quot; android:exported=&quot;true&quot;/&gt;
296        &lt;service
297            android:name=&quot;.services.ContactChooserTargetService&quot;
298            android:permission=&quot;android.permission.BIND_CHOOSER_TARGET_SERVICE&quot;
299            android:exported=&quot;true&quot;&gt;
300            &lt;intent-filter&gt;
301                &lt;action android:name=&quot;android.service.chooser.ChooserTargetService&quot; /&gt;
302            &lt;/intent-filter&gt;
303        &lt;/service&gt;
304        &lt;service android:name=&quot;.services.CompulsoryUpdateService&quot; android:exported=&quot;true&quot;/&gt;
305
306        &lt;provider
307            android:name=&quot;androidx.core.content.FileProvider&quot;
308            android:authorities=&quot;${applicationId}.files&quot;
309            android:exported=&quot;false&quot;
310            android:grantUriPermissions=&quot;true&quot;&gt;
311            &lt;meta-data
312                android:name=&quot;android.support.FILE_PROVIDER_PATHS&quot;
313                android:resource=&quot;@xml/file_paths&quot; /&gt;
314        &lt;/provider&gt;
315        &lt;provider
316            android:name=&quot;.services.BarcodeProvider&quot;
317            android:authorities=&quot;${applicationId}.barcodes&quot;
318            android:exported=&quot;false&quot;
319            android:grantUriPermissions=&quot;true&quot; /&gt;
320
321        &lt;activity
322            android:name=&quot;.ui.ShortcutActivity&quot;
323            android:label=&quot;@string/contact&quot;
324            android:exported=&quot;true&quot;&gt;
325            &lt;intent-filter&gt;
326                &lt;action android:name=&quot;android.intent.action.CREATE_SHORTCUT&quot; /&gt;
327            &lt;/intent-filter&gt;
328        &lt;/activity&gt;
329        &lt;activity
330            android:name=&quot;.ui.MucUsersActivity&quot;
331            android:exported=&quot;true&quot;
332            android:label=&quot;@string/group_chat_members&quot; /&gt;
333        &lt;activity
334            android:name=&quot;.ui.ChannelDiscoveryActivity&quot;
335            android:exported=&quot;true&quot;
336            android:label=&quot;@string/discover_channels&quot; /&gt;
337        &lt;activity
338            android:name=&quot;.ui.RtpSessionActivity&quot;
339            android:autoRemoveFromRecents=&quot;true&quot;
340            android:exported=&quot;true&quot;
341            android:launchMode=&quot;singleInstance&quot;
342            android:supportsPictureInPicture=&quot;true&quot; /&gt;
343    &lt;/application&gt;
344
345&lt;/manifest&gt;
346&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
347&lt;manifest xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
348    xmlns:tools=&quot;http://schemas.android.com/tools&quot;
349    package=&quot;eu.siacs.conversations&quot;&gt;
350
351    &lt;application tools:ignore=&quot;GoogleAppIndexingWarning&quot;&gt;
352        &lt;activity
353            android:name=&quot;.ui.ManageAccountActivity&quot;
354            android:label=&quot;@string/title_activity_manage_accounts&quot;
355            android:launchMode=&quot;singleTask&quot;
356            android:exported=&quot;true&quot;/&gt;
357        &lt;activity
358            android:name=&quot;.ui.MagicCreateActivity&quot;
359            android:label=&quot;@string/create_new_account&quot;
360            android:launchMode=&quot;singleTask&quot;
361            android:exported=&quot;true&quot;/&gt;
362        &lt;activity
363            android:name=&quot;.ui.EasyOnboardingInviteActivity&quot;
364            android:label=&quot;@string/invite_to_app&quot;
365            android:launchMode=&quot;singleTask&quot; /&gt;
366        &lt;activity
367            android:name=&quot;.ui.ImportBackupActivity&quot;
368            android:label=&quot;@string/restore_backup&quot;
369            android:launchMode=&quot;singleTask&quot;
370            android:exported=&quot;true&quot;&gt;
371            &lt;intent-filter&gt;
372                &lt;action android:name=&quot;android.intent.action.VIEW&quot; /&gt;
373                &lt;category android:name=&quot;android.intent.category.DEFAULT&quot; /&gt;
374
375                &lt;data android:mimeType=&quot;application/vnd.conversations.backup&quot; /&gt;
376                &lt;data android:scheme=&quot;content&quot; /&gt;
377            &lt;/intent-filter&gt;
378            &lt;intent-filter&gt;
379                &lt;action android:name=&quot;android.intent.action.VIEW&quot; /&gt;
380                &lt;category android:name=&quot;android.intent.category.DEFAULT&quot; /&gt;
381
382                &lt;data android:mimeType=&quot;application/vnd.conversations.backup&quot; /&gt;
383                &lt;data android:scheme=&quot;file&quot; /&gt;
384            &lt;/intent-filter&gt;
385            &lt;intent-filter&gt;
386                &lt;action android:name=&quot;android.intent.action.VIEW&quot; /&gt;
387
388                &lt;category android:name=&quot;android.intent.category.DEFAULT&quot; /&gt;
389                &lt;category android:name=&quot;android.intent.category.BROWSABLE&quot; /&gt;
390
391                &lt;data android:scheme=&quot;content&quot; /&gt;
392                &lt;data android:host=&quot;*&quot; /&gt;
393                &lt;data android:mimeType=&quot;*/*&quot; /&gt;
394                &lt;data android:pathPattern=&quot;.*\\.ceb&quot; /&gt;
395                &lt;data android:pathPattern=&quot;.*\\..*\\.ceb&quot; /&gt;
396                &lt;data android:pathPattern=&quot;.*\\..*\\..*\\.ceb&quot; /&gt;
397                &lt;data android:pathPattern=&quot;.*\\..*\\..*\\..*\\.ceb&quot; /&gt;
398                &lt;data android:pathPattern=&quot;.*\\..*\\..*\\..*\\..*\\.ceb&quot; /&gt;
399                &lt;data android:pathPattern=&quot;.*\\..*\\..*\\..*\\..*\\..*\\.ceb&quot; /&gt;
400                &lt;data android:pathPattern=&quot;.*\\..*\\..*\\..*\\..*\\..*\\..*\\.ceb&quot; /&gt;
401            &lt;/intent-filter&gt;
402            &lt;intent-filter&gt;
403                &lt;action android:name=&quot;android.intent.action.VIEW&quot; /&gt;
404
405                &lt;category android:name=&quot;android.intent.category.DEFAULT&quot; /&gt;
406                &lt;category android:name=&quot;android.intent.category.BROWSABLE&quot; /&gt;
407
408                &lt;data android:scheme=&quot;file&quot; /&gt;
409                &lt;data android:host=&quot;*&quot; /&gt;
410                &lt;data android:mimeType=&quot;*/*&quot; /&gt;
411                &lt;data android:pathPattern=&quot;.*\\.ceb&quot; /&gt;
412                &lt;data android:pathPattern=&quot;.*\\..*\\.ceb&quot; /&gt;
413                &lt;data android:pathPattern=&quot;.*\\..*\\..*\\.ceb&quot; /&gt;
414                &lt;data android:pathPattern=&quot;.*\\..*\\..*\\..*\\.ceb&quot; /&gt;
415                &lt;data android:pathPattern=&quot;.*\\..*\\..*\\..*\\..*\\.ceb&quot; /&gt;
416                &lt;data android:pathPattern=&quot;.*\\..*\\..*\\..*\\..*\\..*\\.ceb&quot; /&gt;
417                &lt;data android:pathPattern=&quot;.*\\..*\\..*\\..*\\..*\\..*\\..*\\.ceb&quot; /&gt;
418            &lt;/intent-filter&gt;
419        &lt;/activity&gt;
420    &lt;/application&gt;
421&lt;/manifest&gt;
422
423

My gradle file:

1&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
2&lt;manifest xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
3    xmlns:tools=&quot;http://schemas.android.com/tools&quot;
4    package=&quot;eu.siacs.conversations&quot;&gt;
5
6    &lt;uses-sdk tools:overrideLibrary=&quot;net.ypresto.androidtranscoder&quot; /&gt;
7
8    &lt;uses-permission android:name=&quot;android.permission.WRITE_EXTERNAL_STORAGE&quot; /&gt;
9    &lt;uses-permission android:name=&quot;android.permission.READ_EXTERNAL_STORAGE&quot; /&gt;
10    &lt;uses-permission android:name=&quot;android.permission.READ_CONTACTS&quot; /&gt;
11    &lt;uses-permission android:name=&quot;android.permission.READ_PROFILE&quot; /&gt;
12    &lt;uses-permission
13        android:name=&quot;android.permission.READ_PHONE_STATE&quot;
14        android:maxSdkVersion=&quot;22&quot; /&gt;
15    &lt;uses-permission android:name=&quot;android.permission.INTERNET&quot; /&gt;
16    &lt;uses-permission android:name=&quot;android.permission.ACCESS_NETWORK_STATE&quot; /&gt;
17    &lt;uses-permission android:name=&quot;android.permission.WAKE_LOCK&quot; /&gt;
18    &lt;uses-permission android:name=&quot;android.permission.RECEIVE_BOOT_COMPLETED&quot; /&gt;
19    &lt;uses-permission android:name=&quot;android.permission.VIBRATE&quot; /&gt;
20    &lt;uses-permission android:name=&quot;android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS&quot; /&gt;
21    &lt;uses-permission android:name=&quot;android.permission.ACCESS_COARSE_LOCATION&quot; /&gt;
22    &lt;uses-permission android:name=&quot;android.permission.ACCESS_FINE_LOCATION&quot; /&gt;
23    &lt;uses-permission android:name=&quot;android.permission.ACCESS_WIFI_STATE&quot; /&gt;
24    &lt;uses-permission android:name=&quot;android.permission.FOREGROUND_SERVICE&quot; /&gt;
25    &lt;uses-permission android:name=&quot;android.permission.REQUEST_INSTALL_PACKAGES&quot; /&gt;
26
27    &lt;uses-feature
28        android:name=&quot;android.hardware.location&quot;
29        android:required=&quot;false&quot; /&gt;
30    &lt;uses-feature
31        android:name=&quot;android.hardware.location.gps&quot;
32        android:required=&quot;false&quot; /&gt;
33    &lt;uses-feature
34        android:name=&quot;android.hardware.location.network&quot;
35        android:required=&quot;false&quot; /&gt;
36
37    &lt;uses-permission android:name=&quot;android.permission.CAMERA&quot; /&gt;
38    &lt;uses-permission android:name=&quot;android.permission.RECORD_AUDIO&quot; /&gt;
39    &lt;uses-permission android:name=&quot;android.permission.BLUETOOTH&quot; /&gt;
40    &lt;uses-permission android:name=&quot;android.permission.MODIFY_AUDIO_SETTINGS&quot; /&gt;
41    &lt;uses-permission android:name=&quot;android.permission.USE_FULL_SCREEN_INTENT&quot; /&gt;
42    &lt;uses-permission android:name=&quot;android.permission.SYSTEM_ALERT_WINDOW&quot; /&gt;
43
44    &lt;uses-feature
45        android:name=&quot;android.hardware.camera&quot;
46        android:required=&quot;false&quot; /&gt;
47    &lt;uses-feature
48        android:name=&quot;android.hardware.camera.autofocus&quot;
49        android:required=&quot;false&quot; /&gt;
50    &lt;uses-feature
51        android:name=&quot;android.hardware.microphone&quot;
52        android:required=&quot;false&quot; /&gt;
53
54    &lt;application
55        android:name=&quot;.Application&quot;
56        android:allowBackup=&quot;false&quot;
57        android:allowClearUserData=&quot;true&quot;
58        android:appCategory=&quot;social&quot;
59        android:hardwareAccelerated=&quot;true&quot;
60        android:icon=&quot;@mipmap/ic_app_launch&quot;
61        android:label=&quot;@string/app_name&quot;
62        android:largeHeap=&quot;true&quot;
63        android:networkSecurityConfig=&quot;@xml/network_security_configuration&quot;
64        android:requestLegacyExternalStorage=&quot;true&quot;
65        android:roundIcon=&quot;@mipmap/ic_app_launch_round&quot;
66        android:theme=&quot;@style/ConversationsTheme&quot;
67        android:usesCleartextTraffic=&quot;true&quot;
68        android:windowSoftInputMode=&quot;adjustPan|adjustResize&quot;
69        tools:replace=&quot;android:label&quot;
70        tools:targetApi=&quot;q&quot;&gt;
71        &lt;activity
72            android:name=&quot;.ui.search.GroupSearchActivity&quot;
73            android:exported=&quot;true&quot; /&gt;
74        &lt;activity
75            android:name=&quot;.ui.profileUpdating.FavouritesActivity&quot;
76            android:exported=&quot;true&quot; /&gt;
77        &lt;activity
78            android:name=&quot;.ui.profileUpdating.NameActivity&quot;
79            android:exported=&quot;true&quot; /&gt;
80        &lt;activity
81            android:name=&quot;.ui.CompulsoryUpdateActivity&quot;
82            android:exported=&quot;true&quot; /&gt;
83        &lt;activity android:name=&quot;.ui.payments.doPayment.DoPaymentActivity&quot;
84            android:exported=&quot;true&quot; /&gt;
85        &lt;activity android:name=&quot;.ui.individualList.IndividualListActivity&quot;
86            android:exported=&quot;true&quot; /&gt;
87        &lt;activity android:name=&quot;.ui.payments.setPayment.SetPaymentActivity&quot;
88            android:exported=&quot;true&quot; /&gt;
89        &lt;activity android:name=&quot;.ui.login.otpActivity.OTPActivity&quot;
90            android:exported=&quot;true&quot; /&gt;
91        &lt;activity android:name=&quot;.ui.login.loginActivity.LoginActivity&quot;
92            android:exported=&quot;true&quot; /&gt;
93
94        &lt;service android:name=&quot;.services.XmppConnectionService&quot; android:exported=&quot;true&quot; /&gt;
95
96        &lt;receiver android:name=&quot;.services.EventReceiver&quot;
97            android:exported=&quot;true&quot;&gt;
98            &lt;intent-filter&gt;
99                &lt;action android:name=&quot;android.intent.action.BOOT_COMPLETED&quot; /&gt;
100                &lt;action android:name=&quot;android.net.conn.CONNECTIVITY_CHANGE&quot; /&gt;
101                &lt;action android:name=&quot;android.intent.action.ACTION_SHUTDOWN&quot; /&gt;
102                &lt;action android:name=&quot;android.media.RINGER_MODE_CHANGED&quot; /&gt;
103            &lt;/intent-filter&gt;
104        &lt;/receiver&gt;
105
106        &lt;activity
107            android:name=&quot;.ui.ShareLocationActivity&quot;
108            android:label=&quot;@string/title_activity_share_location&quot;
109            android:exported=&quot;true&quot;/&gt;
110        &lt;activity
111            android:name=&quot;.ui.SearchActivity&quot;
112            android:label=&quot;@string/search_messages&quot;
113            android:exported=&quot;true&quot; /&gt;
114        &lt;activity
115            android:name=&quot;.ui.RecordingActivity&quot;
116            android:configChanges=&quot;orientation|screenSize&quot;
117            android:theme=&quot;@style/ConversationsTheme.Dialog&quot;
118            android:exported=&quot;true&quot; /&gt;
119        &lt;activity
120            android:name=&quot;.ui.ShowLocationActivity&quot;
121            android:label=&quot;@string/title_activity_show_location&quot;
122            android:exported=&quot;true&quot; /&gt;
123        &lt;activity
124            android:name=&quot;.ui.SplashActivity&quot;
125            android:theme=&quot;@style/SplashTheme&quot;
126            android:exported=&quot;true&quot;&gt;
127            &lt;intent-filter&gt;
128                &lt;action android:name=&quot;android.intent.action.MAIN&quot; /&gt;
129
130                &lt;category android:name=&quot;android.intent.category.LAUNCHER&quot; /&gt;
131            &lt;/intent-filter&gt;
132        &lt;/activity&gt;
133        &lt;activity
134            android:name=&quot;.ui.ConversationsActivity&quot;
135            android:label=&quot;@string/app_name&quot;
136            android:launchMode=&quot;singleTask&quot;
137            android:minWidth=&quot;300dp&quot;
138            android:minHeight=&quot;300dp&quot;
139            android:exported=&quot;true&quot;
140            android:windowSoftInputMode=&quot;stateHidden&quot; /&gt;
141        &lt;activity
142            android:name=&quot;.ui.ScanActivity&quot;
143            android:screenOrientation=&quot;portrait&quot;
144            android:exported=&quot;true&quot;
145            android:theme=&quot;@style/ConversationsTheme.FullScreen&quot;
146            android:windowSoftInputMode=&quot;stateAlwaysHidden&quot; /&gt;
147        &lt;activity
148            android:name=&quot;.ui.UriHandlerActivity&quot;
149            android:label=&quot;@string/app_name&quot;
150            android:exported=&quot;true&quot;&gt;
151            &lt;intent-filter&gt;
152                &lt;action android:name=&quot;android.intent.action.VIEW&quot; /&gt;
153
154                &lt;category android:name=&quot;android.intent.category.DEFAULT&quot; /&gt;
155                &lt;category android:name=&quot;android.intent.category.BROWSABLE&quot; /&gt;
156
157                &lt;data android:scheme=&quot;xmpp&quot; /&gt;
158            &lt;/intent-filter&gt;
159            &lt;intent-filter android:autoVerify=&quot;true&quot;&gt;
160                &lt;action android:name=&quot;android.intent.action.VIEW&quot; /&gt;
161
162                &lt;category android:name=&quot;android.intent.category.DEFAULT&quot; /&gt;
163                &lt;category android:name=&quot;android.intent.category.BROWSABLE&quot; /&gt;
164
165                &lt;data android:scheme=&quot;https&quot; /&gt;
166                &lt;data android:host=&quot;im.app.in&quot; /&gt;
167                &lt;data android:pathPrefix=&quot;/i/&quot; /&gt;
168                &lt;data android:pathPrefix=&quot;/j/&quot; /&gt;
169            &lt;/intent-filter&gt;
170            &lt;intent-filter&gt;
171                &lt;action android:name=&quot;android.intent.action.SENDTO&quot; /&gt;
172
173                &lt;category android:name=&quot;android.intent.category.DEFAULT&quot; /&gt;
174
175                &lt;data android:scheme=&quot;imto&quot; /&gt;
176                &lt;data android:host=&quot;jabber&quot; /&gt;
177            &lt;/intent-filter&gt;
178        &lt;/activity&gt;
179        &lt;activity
180            android:name=&quot;.ui.StartConversationActivity&quot;
181            android:label=&quot;@string/title_activity_start_conversation&quot;
182            android:launchMode=&quot;singleTop&quot;
183            android:exported=&quot;true&quot;&gt;
184            &lt;intent-filter&gt;
185                &lt;action android:name=&quot;android.intent.action.VIEW&quot; /&gt;
186            &lt;/intent-filter&gt;
187        &lt;/activity&gt;
188        &lt;activity
189            android:name=&quot;.ui.SettingsActivity&quot;
190            android:label=&quot;@string/title_activity_settings&quot;
191            android:exported=&quot;true&quot;&gt;
192            &lt;intent-filter&gt;
193                &lt;action android:name=&quot;android.intent.action.MAIN&quot; /&gt;
194
195                &lt;category android:name=&quot;android.intent.category.NOTIFICATION_PREFERENCES&quot; /&gt;
196            &lt;/intent-filter&gt;
197        &lt;/activity&gt;
198        &lt;activity
199            android:name=&quot;.ui.ChooseContactActivity&quot;
200            android:label=&quot;@string/title_activity_choose_contact&quot;
201            android:exported=&quot;true&quot; /&gt;
202        &lt;activity
203            android:name=&quot;.ui.BlocklistActivity&quot;
204            android:label=&quot;@string/title_activity_block_list&quot;
205            android:exported=&quot;true&quot;/&gt;
206        &lt;activity
207            android:name=&quot;.ui.ChangePasswordActivity&quot;
208            android:label=&quot;@string/change_password_on_server&quot;
209            android:exported=&quot;true&quot;/&gt;
210        &lt;activity
211            android:name=&quot;.ui.ChooseAccountForProfilePictureActivity&quot;
212            android:enabled=&quot;false&quot;
213            android:label=&quot;@string/choose_account&quot;
214            android:exported=&quot;true&quot;&gt;
215            &lt;intent-filter android:label=&quot;@string/set_profile_picture&quot;&gt;
216                &lt;action android:name=&quot;android.intent.action.ATTACH_DATA&quot; /&gt;
217
218                &lt;category android:name=&quot;android.intent.category.DEFAULT&quot; /&gt;
219
220                &lt;data android:mimeType=&quot;image/*&quot; /&gt;
221            &lt;/intent-filter&gt;
222        &lt;/activity&gt;
223        &lt;activity
224            android:name=&quot;.ui.ShareViaAccountActivity&quot;
225            android:label=&quot;@string/title_activity_share_via_account&quot;
226            android:launchMode=&quot;singleTop&quot;
227            android:exported=&quot;true&quot; /&gt;
228        &lt;activity
229            android:name=&quot;.ui.EditAccountActivity&quot;
230            android:launchMode=&quot;singleTop&quot;
231            android:exported=&quot;true&quot;
232            android:windowSoftInputMode=&quot;stateHidden|adjustResize&quot; /&gt;
233        &lt;activity
234            android:name=&quot;.ui.ConferenceDetailsActivity&quot;
235            android:label=&quot;@string/action_muc_details&quot;
236            android:exported=&quot;true&quot;
237            android:windowSoftInputMode=&quot;stateHidden&quot; /&gt;
238        &lt;activity
239            android:name=&quot;.ui.ContactDetailsActivity&quot;
240            android:exported=&quot;true&quot;
241            android:windowSoftInputMode=&quot;stateHidden&quot; /&gt;
242        &lt;activity
243            android:name=&quot;.ui.PublishProfilePictureActivity&quot;
244            android:label=&quot;@string/mgmt_account_publish_avatar&quot;
245            android:exported=&quot;true&quot;
246            android:windowSoftInputMode=&quot;stateHidden&quot; /&gt;
247        &lt;activity
248            android:name=&quot;.ui.PublishGroupChatProfilePictureActivity&quot;
249            android:exported=&quot;true&quot;
250            android:label=&quot;@string/group_chat_avatar&quot; /&gt;
251        &lt;activity
252            android:name=&quot;.ui.ShareWithActivity&quot;
253            android:label=&quot;@string/app_name&quot;
254            android:launchMode=&quot;singleTop&quot;
255            android:exported=&quot;true&quot;&gt;
256            &lt;intent-filter&gt;
257                &lt;action android:name=&quot;android.intent.action.SEND&quot; /&gt;
258                &lt;action android:name=&quot;android.intent.action.SEND_MULTIPLE&quot; /&gt;
259
260                &lt;category android:name=&quot;android.intent.category.DEFAULT&quot; /&gt;
261
262                &lt;data android:mimeType=&quot;text/plain&quot; /&gt;
263            &lt;/intent-filter&gt;
264            &lt;intent-filter&gt;
265                &lt;action android:name=&quot;android.intent.action.SEND&quot; /&gt;
266                &lt;action android:name=&quot;android.intent.action.SEND_MULTIPLE&quot; /&gt;
267
268                &lt;category android:name=&quot;android.intent.category.DEFAULT&quot; /&gt;
269
270                &lt;data android:mimeType=&quot;*/*&quot; /&gt;
271            &lt;/intent-filter&gt;
272
273            &lt;!-- the value here needs to be the full class name; independent of the configured applicationId --&gt;
274            &lt;meta-data
275                android:name=&quot;android.service.chooser.chooser_target_service&quot;
276                android:value=&quot;eu.siacs.conversations.services.ContactChooserTargetService&quot; /&gt;
277        &lt;/activity&gt;
278        &lt;activity
279            android:name=&quot;.ui.TrustKeysActivity&quot;
280            android:label=&quot;@string/trust_omemo_fingerprints&quot;
281            android:exported=&quot;true&quot;
282            android:windowSoftInputMode=&quot;stateAlwaysHidden&quot; /&gt;
283        &lt;activity
284            android:name=&quot;com.theartofdev.edmodo.cropper.CropImageActivity&quot;
285            android:exported=&quot;true&quot;
286            android:theme=&quot;@style/Base.Theme.AppCompat&quot; /&gt;
287        &lt;activity android:name=&quot;.ui.MemorizingActivity&quot;
288            android:exported=&quot;true&quot; /&gt;
289        &lt;activity
290            android:name=&quot;.ui.MediaBrowserActivity&quot;
291            android:exported=&quot;true&quot;
292            android:label=&quot;@string/media_browser&quot; /&gt;
293
294        &lt;service android:name=&quot;.services.ExportBackupService&quot; android:exported=&quot;true&quot;/&gt;
295        &lt;service android:name=&quot;.services.ImportBackupService&quot; android:exported=&quot;true&quot;/&gt;
296        &lt;service
297            android:name=&quot;.services.ContactChooserTargetService&quot;
298            android:permission=&quot;android.permission.BIND_CHOOSER_TARGET_SERVICE&quot;
299            android:exported=&quot;true&quot;&gt;
300            &lt;intent-filter&gt;
301                &lt;action android:name=&quot;android.service.chooser.ChooserTargetService&quot; /&gt;
302            &lt;/intent-filter&gt;
303        &lt;/service&gt;
304        &lt;service android:name=&quot;.services.CompulsoryUpdateService&quot; android:exported=&quot;true&quot;/&gt;
305
306        &lt;provider
307            android:name=&quot;androidx.core.content.FileProvider&quot;
308            android:authorities=&quot;${applicationId}.files&quot;
309            android:exported=&quot;false&quot;
310            android:grantUriPermissions=&quot;true&quot;&gt;
311            &lt;meta-data
312                android:name=&quot;android.support.FILE_PROVIDER_PATHS&quot;
313                android:resource=&quot;@xml/file_paths&quot; /&gt;
314        &lt;/provider&gt;
315        &lt;provider
316            android:name=&quot;.services.BarcodeProvider&quot;
317            android:authorities=&quot;${applicationId}.barcodes&quot;
318            android:exported=&quot;false&quot;
319            android:grantUriPermissions=&quot;true&quot; /&gt;
320
321        &lt;activity
322            android:name=&quot;.ui.ShortcutActivity&quot;
323            android:label=&quot;@string/contact&quot;
324            android:exported=&quot;true&quot;&gt;
325            &lt;intent-filter&gt;
326                &lt;action android:name=&quot;android.intent.action.CREATE_SHORTCUT&quot; /&gt;
327            &lt;/intent-filter&gt;
328        &lt;/activity&gt;
329        &lt;activity
330            android:name=&quot;.ui.MucUsersActivity&quot;
331            android:exported=&quot;true&quot;
332            android:label=&quot;@string/group_chat_members&quot; /&gt;
333        &lt;activity
334            android:name=&quot;.ui.ChannelDiscoveryActivity&quot;
335            android:exported=&quot;true&quot;
336            android:label=&quot;@string/discover_channels&quot; /&gt;
337        &lt;activity
338            android:name=&quot;.ui.RtpSessionActivity&quot;
339            android:autoRemoveFromRecents=&quot;true&quot;
340            android:exported=&quot;true&quot;
341            android:launchMode=&quot;singleInstance&quot;
342            android:supportsPictureInPicture=&quot;true&quot; /&gt;
343    &lt;/application&gt;
344
345&lt;/manifest&gt;
346&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
347&lt;manifest xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
348    xmlns:tools=&quot;http://schemas.android.com/tools&quot;
349    package=&quot;eu.siacs.conversations&quot;&gt;
350
351    &lt;application tools:ignore=&quot;GoogleAppIndexingWarning&quot;&gt;
352        &lt;activity
353            android:name=&quot;.ui.ManageAccountActivity&quot;
354            android:label=&quot;@string/title_activity_manage_accounts&quot;
355            android:launchMode=&quot;singleTask&quot;
356            android:exported=&quot;true&quot;/&gt;
357        &lt;activity
358            android:name=&quot;.ui.MagicCreateActivity&quot;
359            android:label=&quot;@string/create_new_account&quot;
360            android:launchMode=&quot;singleTask&quot;
361            android:exported=&quot;true&quot;/&gt;
362        &lt;activity
363            android:name=&quot;.ui.EasyOnboardingInviteActivity&quot;
364            android:label=&quot;@string/invite_to_app&quot;
365            android:launchMode=&quot;singleTask&quot; /&gt;
366        &lt;activity
367            android:name=&quot;.ui.ImportBackupActivity&quot;
368            android:label=&quot;@string/restore_backup&quot;
369            android:launchMode=&quot;singleTask&quot;
370            android:exported=&quot;true&quot;&gt;
371            &lt;intent-filter&gt;
372                &lt;action android:name=&quot;android.intent.action.VIEW&quot; /&gt;
373                &lt;category android:name=&quot;android.intent.category.DEFAULT&quot; /&gt;
374
375                &lt;data android:mimeType=&quot;application/vnd.conversations.backup&quot; /&gt;
376                &lt;data android:scheme=&quot;content&quot; /&gt;
377            &lt;/intent-filter&gt;
378            &lt;intent-filter&gt;
379                &lt;action android:name=&quot;android.intent.action.VIEW&quot; /&gt;
380                &lt;category android:name=&quot;android.intent.category.DEFAULT&quot; /&gt;
381
382                &lt;data android:mimeType=&quot;application/vnd.conversations.backup&quot; /&gt;
383                &lt;data android:scheme=&quot;file&quot; /&gt;
384            &lt;/intent-filter&gt;
385            &lt;intent-filter&gt;
386                &lt;action android:name=&quot;android.intent.action.VIEW&quot; /&gt;
387
388                &lt;category android:name=&quot;android.intent.category.DEFAULT&quot; /&gt;
389                &lt;category android:name=&quot;android.intent.category.BROWSABLE&quot; /&gt;
390
391                &lt;data android:scheme=&quot;content&quot; /&gt;
392                &lt;data android:host=&quot;*&quot; /&gt;
393                &lt;data android:mimeType=&quot;*/*&quot; /&gt;
394                &lt;data android:pathPattern=&quot;.*\\.ceb&quot; /&gt;
395                &lt;data android:pathPattern=&quot;.*\\..*\\.ceb&quot; /&gt;
396                &lt;data android:pathPattern=&quot;.*\\..*\\..*\\.ceb&quot; /&gt;
397                &lt;data android:pathPattern=&quot;.*\\..*\\..*\\..*\\.ceb&quot; /&gt;
398                &lt;data android:pathPattern=&quot;.*\\..*\\..*\\..*\\..*\\.ceb&quot; /&gt;
399                &lt;data android:pathPattern=&quot;.*\\..*\\..*\\..*\\..*\\..*\\.ceb&quot; /&gt;
400                &lt;data android:pathPattern=&quot;.*\\..*\\..*\\..*\\..*\\..*\\..*\\.ceb&quot; /&gt;
401            &lt;/intent-filter&gt;
402            &lt;intent-filter&gt;
403                &lt;action android:name=&quot;android.intent.action.VIEW&quot; /&gt;
404
405                &lt;category android:name=&quot;android.intent.category.DEFAULT&quot; /&gt;
406                &lt;category android:name=&quot;android.intent.category.BROWSABLE&quot; /&gt;
407
408                &lt;data android:scheme=&quot;file&quot; /&gt;
409                &lt;data android:host=&quot;*&quot; /&gt;
410                &lt;data android:mimeType=&quot;*/*&quot; /&gt;
411                &lt;data android:pathPattern=&quot;.*\\.ceb&quot; /&gt;
412                &lt;data android:pathPattern=&quot;.*\\..*\\.ceb&quot; /&gt;
413                &lt;data android:pathPattern=&quot;.*\\..*\\..*\\.ceb&quot; /&gt;
414                &lt;data android:pathPattern=&quot;.*\\..*\\..*\\..*\\.ceb&quot; /&gt;
415                &lt;data android:pathPattern=&quot;.*\\..*\\..*\\..*\\..*\\.ceb&quot; /&gt;
416                &lt;data android:pathPattern=&quot;.*\\..*\\..*\\..*\\..*\\..*\\.ceb&quot; /&gt;
417                &lt;data android:pathPattern=&quot;.*\\..*\\..*\\..*\\..*\\..*\\..*\\.ceb&quot; /&gt;
418            &lt;/intent-filter&gt;
419        &lt;/activity&gt;
420    &lt;/application&gt;
421&lt;/manifest&gt;
422
423import com.android.build.OutputFile
424
425// Top-level build file where you can add configuration options common to all
426// sub-projects/modules.
427buildscript {
428    ext.kotlin_version = &quot;1.5.21&quot;
429    repositories {
430        google()
431        mavenCentral()
432        maven { url 'https://jitpack.io' }
433        gradlePluginPortal()
434    }
435    dependencies {
436        classpath 'com.android.tools.build:gradle:4.2.2'
437        classpath 'com.google.gms:google-services:4.3.8'
438        classpath &quot;org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version&quot;
439    }
440}
441
442apply plugin: 'com.android.application'
443apply plugin: 'kotlin-android'
444apply plugin: 'kotlin-kapt'
445apply plugin: 'com.google.gms.google-services'
446
447repositories {
448    google()
449    mavenCentral()
450    jcenter()
451    maven { url 'https://jitpack.io' }
452}
453
454configurations {
455    conversationsFreeCompatImplementation
456}
457
458dependencies {
459    implementation 'androidx.viewpager:viewpager:1.0.0'
460    implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
461
462    implementation &quot;org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version&quot;
463
464    implementation 'org.sufficientlysecure:openpgp-api:10.0'
465    implementation 'com.theartofdev.edmodo:android-image-cropper:2.8.0'
466    implementation 'androidx.appcompat:appcompat:1.3.1'
467    implementation 'androidx.exifinterface:exifinterface:1.3.2'
468    implementation 'androidx.cardview:cardview:1.0.0'
469    implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
470    implementation 'androidx.emoji:emoji:1.1.0'
471    implementation 'com.google.android.material:material:1.4.0'
472    conversationsFreeCompatImplementation 'androidx.emoji:emoji-bundled:1.1.0'
473    implementation 'org.bouncycastle:bcmail-jdk15on:1.64'
474    //zxing stopped supporting Java 7 so we have to stick with 3.3.3
475    //https://github.com/zxing/zxing/issues/1170
476    implementation 'com.google.zxing:core:3.4.1'
477    implementation 'de.measite.minidns:minidns-hla:0.2.4'
478    implementation 'me.leolin:ShortcutBadger:1.1.22@aar'
479    implementation 'org.whispersystems:signal-protocol-java:2.8.1'
480    implementation 'com.makeramen:roundedimageview:2.3.0'
481    implementation &quot;com.wefika:flowlayout:0.4.1&quot;
482    implementation 'net.ypresto.androidtranscoder:android-transcoder:0.3.0'
483    implementation 'org.jxmpp:jxmpp-jid:1.0.1'
484    implementation 'org.osmdroid:osmdroid-android:6.1.10'
485    implementation 'org.hsluv:hsluv:0.2'
486    implementation 'org.conscrypt:conscrypt-android:2.5.2'
487    implementation 'me.drakeet.support:toastcompat:1.1.0'
488    implementation &quot;com.leinardi.android:speed-dial:3.2.0&quot;
489
490    implementation &quot;com.squareup.retrofit2:retrofit:2.9.0&quot;
491    implementation &quot;com.squareup.retrofit2:converter-gson:2.9.0&quot;
492    implementation &quot;com.squareup.okhttp3:okhttp:5.0.0-alpha.2&quot;
493    implementation 'com.squareup.okhttp3:logging-interceptor:5.0.0-alpha.2'
494
495    implementation 'com.google.guava:guava:30.1.1-android'
496    implementation 'org.webrtc:google-webrtc:1.0.32006'
497
498    // Lifecycle Helper
499    implementation &quot;androidx.activity:activity-ktx:1.3.0-rc02&quot;
500    implementation &quot;androidx.fragment:fragment-ktx:1.3.6&quot;
501
502    //Navigation
503    implementation 'androidx.navigation:navigation-fragment-ktx:2.3.5'
504    implementation 'androidx.navigation:navigation-ui-ktx:2.3.5'
505
506    //CardView
507    implementation &quot;androidx.cardview:cardview:1.0.0&quot;
508
509    //Country Code Picker
510    implementation 'com.hbb20:ccp:2.5.3'
511
512    //Firebase
513    implementation 'com.google.firebase:firebase-bom:28.3.0'
514    implementation 'com.google.firebase:firebase-auth-ktx:21.0.1'
515    implementation 'androidx.browser:browser:1.3.0'
516
517    //OTP view
518    implementation 'com.github.mukeshsolanki:android-otpview-pinview:2.1.2'
519
520    //Retrofit
521    implementation 'com.squareup.retrofit2:retrofit:2.9.0'
522    implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
523
524    //Gson
525    implementation 'com.google.code.gson:gson:2.8.7'
526
527    //Multidex
528    implementation 'androidx.multidex:multidex:2.0.1'
529
530    //Round Image
531    implementation 'de.hdodenhof:circleimageview:3.1.0'
532
533    // Button with image and text
534    implementation 'com.github.Omega-R:OmegaCenterIconButton:0.0.4@aar'
535
536    //Razor pay
537    implementation 'com.razorpay:checkout:1.6.10'
538
539    //Mixpanel Tracking
540    implementation 'com.mixpanel.android:mixpanel-android:5.9.1'
541
542    //Loading screen
543    implementation 'com.wang.avi:library:2.1.3'
544
545    //Loading
546    implementation 'com.wang.avi:library:2.1.3'
547
548    //Form
549    implementation 'com.quickbirdstudios:surveykit:1.1.0'
550}
551
552ext {
553    travisBuild = System.getenv(&quot;TRAVIS&quot;) == &quot;true&quot;
554    preDexEnabled = System.getProperty(&quot;pre-dex&quot;, &quot;true&quot;)
555    abiCodes = ['armeabi-v7a': 1, 'x86': 2, 'x86_64': 3, 'arm64-v8a': 4]
556}
557
558android {
559    compileSdkVersion 31
560
561    defaultConfig {
562        minSdkVersion 24
563        targetSdkVersion 31
564        versionCode 44
565        versionName &quot;2.0.4&quot;
566        multiDexEnabled = true
567        archivesBaseName += &quot;-$versionName&quot;
568        applicationId &quot;com.app.app&quot;
569        resValue &quot;string&quot;, &quot;applicationId&quot;, applicationId
570        def appName = &quot;app&quot;
571        resValue &quot;string&quot;, &quot;app_name&quot;, appName
572        buildConfigField &quot;String&quot;, &quot;APP_NAME&quot;, &quot;\&quot;$appName\&quot;&quot;
573    }
574
575    splits {
576        abi {
577            universalApk true
578            enable true
579        }
580    }
581
582    configurations {
583        compile.exclude group: 'org.jetbrains' , module:'annotations'
584    }
585
586    dataBinding {
587        enabled true
588    }
589
590    dexOptions {
591        // Skip pre-dexing when running on Travis CI or when disabled via -Dpre-dex=false.
592        preDexLibraries = preDexEnabled &amp;&amp; !travisBuild
593        jumboMode true
594    }
595
596    compileOptions {
597        sourceCompatibility JavaVersion.VERSION_1_8
598        targetCompatibility JavaVersion.VERSION_1_8
599    }
600
601    flavorDimensions(&quot;mode&quot;, &quot;distribution&quot;, &quot;emoji&quot;)
602
603    productFlavors {
604
605        conversations {
606            dimension &quot;mode&quot;
607        }
608        free {
609            dimension &quot;distribution&quot;
610            versionNameSuffix &quot;+f&quot;
611        }
612        compat {
613            dimension &quot;emoji&quot;
614            versionNameSuffix &quot;c&quot;
615        }
616    }
617
618    sourceSets {
619        conversationsFreeCompat {
620            java {
621                srcDir 'src/freeCompat/java'
622                srcDir 'src/conversationsFree/java'
623            }
624        }
625    }
626
627    buildTypes {
628        release {
629            shrinkResources true
630            minifyEnabled true
631            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
632            versionNameSuffix &quot;r&quot;
633        }
634        debug {
635            shrinkResources true
636            minifyEnabled true
637            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
638            versionNameSuffix &quot;d&quot;
639        }
640    }
641
642
643    if (new File(&quot;signing.properties&quot;).exists()) {
644        Properties props = new Properties()
645        props.load(new FileInputStream(file(&quot;signing.properties&quot;)))
646
647        signingConfigs {
648            release {
649                storeFile file(props['keystore'])
650                storePassword props['keystore.password']
651                keyAlias props['keystore.alias']
652                keyPassword props['keystore.password']
653            }
654        }
655        buildTypes.release.signingConfig = signingConfigs.release
656    }
657
658    lintOptions {
659        disable 'MissingTranslation', 'InvalidPackage','AppCompatResource'
660    }
661
662    subprojects {
663
664        afterEvaluate {
665            if (getPlugins().hasPlugin('android') ||
666                    getPlugins().hasPlugin('android-library')) {
667
668                configure(android.lintOptions) {
669                    disable 'AndroidGradlePluginVersion', 'MissingTranslation'
670                }
671            }
672
673        }
674    }
675
676    packagingOptions {
677        exclude 'META-INF/BCKEY.DSA'
678        exclude 'META-INF/BCKEY.SF'
679    }
680
681    android.applicationVariants.all { variant -&gt;
682        variant.outputs.each { output -&gt;
683            def baseAbiVersionCode = project.ext.abiCodes.get(output.getFilter(OutputFile.ABI))
684            if (baseAbiVersionCode != null) {
685                output.versionCodeOverride = (100 * variant.versionCode) + baseAbiVersionCode
686            }
687        }
688
689    }
690}
691

ANSWER

Answered 2021-Aug-04 at 09:18

I'm not sure what you're using to code, but in order to set it in Android Studio, open the manifest of your project and under the "activity" section, put android:exported="true"(or false if that is what you prefer). I have attached an example.

Source https://stackoverflow.com/questions/68554294

QUESTION

How to open emulators in different windows at Android Studio (Bumblebee | 2021.1.1)?

Asked 2022-Feb-22 at 19:06

I have two running emulators but they open together in different tabs and in one single window.

How to open them in two different window?

enter image description here

enter image description here

1Android Studio Bumblebee | 2021.1.1
2Build #AI-211.7628.21.2111.8092744, built on January 19, 2022
3Runtime version: 11.0.11+0-b60-7590822 amd64
4VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
5Linux 5.4.0-96-generic
6GC: G1 Young Generation, G1 Old Generation
7Memory: 3072M
8Cores: 12
9Registry: external.system.auto.import.disabled=true, debugger.watches.in.variables=false
10Non-Bundled Plugins: JUnit4-Parallel-Runner (1.5), com.intellij.javafx (1.0.3), com.intellij.marketplace (211.7628.36), com.atlassian.bitbucket.references (2021.1.195), com.thoughtworks.gauge (211.6693.111), org.jetbrains.kotlin (211-1.6.10-release-923-AS7442.40), com.developerphil.adbidea (1.6.4)
11Current Desktop: ubuntu:GNOME
12

ANSWER

Answered 2022-Feb-17 at 10:47

File->Settings->Tools->Emulator, and uncheck Launch in a tool window Then they will open in their own stand alone windows again.

Source https://stackoverflow.com/questions/70923189

QUESTION

How to install the Bumblebee 2021.1.1 Android Studio Patch?

Asked 2022-Feb-10 at 19:28

When I open Android Studio I receive a notification saying that an update is available:

1The latest stable release of Android Studio is now available for download.
2
3Android Studio Bumblebee | 2021.1.1 Patch 1 is a major new release and includes performance improvements, bug fixes and new features.
4
5- Intellij 2021.1.1 Platform Update
6- New Device Manager
7- ADB over Wi-Fi
8- Run Instrumented Tests in Android Studio using Gradle
9- Android Gradle Plugin Upgrade Assistant now updates API usage
10- Non-Transitive R classes on for new projects
11- Apple Silicon Support Update
12- Jank detection track in Profilers
13- Profileable app profiling support in Studio Profilers
14- Network Inspection and ability to capture Layout Inspector snapshots
15- Support for Compose semantics in the Layout Inspector
16- Interactive Preview
17- Animated Vector Drawables Preview
18- Updated Device picker for Design Tools
19
20Important After updating, you need to restart Android Studio to apply any memory settings you migrate from an earlier version of the IDE.
21Release Notes
22

However when I click on the Download button it opens a web page to re-download the whole program instead of updating it. It's a bit confusing because it's a minor update.

ANSWER

Answered 2022-Feb-10 at 11:09

This issue was fixed by Google (10 February 2022).

You can now update Android Studio normally.

Thank you all for helping to bring this problem to Google's attention.

Source https://stackoverflow.com/questions/71006400

QUESTION

Is there way in ggplot2 to place text on a curved path?

Asked 2022-Feb-02 at 10:17

Is there a way to put text along a density line, or for that matter, any path, in ggplot2? By that, I mean either once as a label, in this style of xkcd: 1835, 1950 (middle panel), 1392, or 2234 (middle panel). Alternatively, is there a way to have the line be repeating text, such as this xkcd #930 ? My apologies for all the xkcd, I'm not sure what these styles are called, and it's the only place I can think of that I've seen this before to differentiate areas in this way.

Note: I'm not talking about the hand-drawn xkcd style, nor putting flat labels at the top

I know I can place a straight/flat piece of text, such as via annotate or geom_text, but I'm curious about bending such text so it appears to be along the curve of the data.

I'm also curious if there is a name for this style of text-along-line?

Example ggplot2 graph using annotate(...):

ggplot graph with horizontal text

Above example graph modified with curved text in Inkscape:

modified version of first graph with text following curved paths


Edit: Here's the data for the first two trial runs in March and April, as requested:

1df &lt;- data.frame(
2  monthly_run = c('March', 'March', 'March', 'March', 'March', 'March', 'March', 
3                  'March', 'March', 'March', 'March', 'March', 'March', 'March', 
4                  'April', 'April', 'April', 'April', 'April', 'April', 'April', 
5                  'April', 'April', 'April', 'April', 'April', 'April', 'April'),
6  duration    = c(36, 44, 45, 48, 50, 50, 51, 54, 55, 57, 60, 60, 60, 60, 30,
7                  40, 44, 47, 47, 47, 53, 53, 54, 55, 56, 57, 69, 77)
8  )
9
10ggplot(df, aes(x = duration, group = monthly_run, color = monthly_run)) + 
11  geom_density() + 
12  theme_minimal()`
13

ANSWER

Answered 2021-Nov-08 at 11:31

Great question. I have often thought about this. I don't know of any packages that allow it natively, but it's not terribly difficult to do it yourself, since geom_text accepts angle as an aesthetic mapping.

Say we have the following plot:

1df &lt;- data.frame(
2  monthly_run = c('March', 'March', 'March', 'March', 'March', 'March', 'March', 
3                  'March', 'March', 'March', 'March', 'March', 'March', 'March', 
4                  'April', 'April', 'April', 'April', 'April', 'April', 'April', 
5                  'April', 'April', 'April', 'April', 'April', 'April', 'April'),
6  duration    = c(36, 44, 45, 48, 50, 50, 51, 54, 55, 57, 60, 60, 60, 60, 30,
7                  40, 44, 47, 47, 47, 53, 53, 54, 55, 56, 57, 69, 77)
8  )
9
10ggplot(df, aes(x = duration, group = monthly_run, color = monthly_run)) + 
11  geom_density() + 
12  theme_minimal()`
13library(ggplot2)
14
15df &lt;- data.frame(y = sin(seq(0, pi, length.out = 100)),
16                 x = seq(0, pi, length.out = 100))
17
18p &lt;- ggplot(df, aes(x, y)) + 
19  geom_line() + 
20  coord_equal() +
21  theme_bw()
22
23p
24

And the following label that we want to run along it:

1df &lt;- data.frame(
2  monthly_run = c('March', 'March', 'March', 'March', 'March', 'March', 'March', 
3                  'March', 'March', 'March', 'March', 'March', 'March', 'March', 
4                  'April', 'April', 'April', 'April', 'April', 'April', 'April', 
5                  'April', 'April', 'April', 'April', 'April', 'April', 'April'),
6  duration    = c(36, 44, 45, 48, 50, 50, 51, 54, 55, 57, 60, 60, 60, 60, 30,
7                  40, 44, 47, 47, 47, 53, 53, 54, 55, 56, 57, 69, 77)
8  )
9
10ggplot(df, aes(x = duration, group = monthly_run, color = monthly_run)) + 
11  geom_density() + 
12  theme_minimal()`
13library(ggplot2)
14
15df &lt;- data.frame(y = sin(seq(0, pi, length.out = 100)),
16                 x = seq(0, pi, length.out = 100))
17
18p &lt;- ggplot(df, aes(x, y)) + 
19  geom_line() + 
20  coord_equal() +
21  theme_bw()
22
23p
24label &lt;- &quot;PIRATES VS NINJAS&quot;
25

We can split the label into characters:

1df &lt;- data.frame(
2  monthly_run = c('March', 'March', 'March', 'March', 'March', 'March', 'March', 
3                  'March', 'March', 'March', 'March', 'March', 'March', 'March', 
4                  'April', 'April', 'April', 'April', 'April', 'April', 'April', 
5                  'April', 'April', 'April', 'April', 'April', 'April', 'April'),
6  duration    = c(36, 44, 45, 48, 50, 50, 51, 54, 55, 57, 60, 60, 60, 60, 30,
7                  40, 44, 47, 47, 47, 53, 53, 54, 55, 56, 57, 69, 77)
8  )
9
10ggplot(df, aes(x = duration, group = monthly_run, color = monthly_run)) + 
11  geom_density() + 
12  theme_minimal()`
13library(ggplot2)
14
15df &lt;- data.frame(y = sin(seq(0, pi, length.out = 100)),
16                 x = seq(0, pi, length.out = 100))
17
18p &lt;- ggplot(df, aes(x, y)) + 
19  geom_line() + 
20  coord_equal() +
21  theme_bw()
22
23p
24label &lt;- &quot;PIRATES VS NINJAS&quot;
25label &lt;- strsplit(label, &quot;&quot;)[[1]]
26

Now comes the tricky part. We need to space the letters evenly along the path, which requires working out the x co-ordinates that achieve this. We need a couple of helper functions here:

1df &lt;- data.frame(
2  monthly_run = c('March', 'March', 'March', 'March', 'March', 'March', 'March', 
3                  'March', 'March', 'March', 'March', 'March', 'March', 'March', 
4                  'April', 'April', 'April', 'April', 'April', 'April', 'April', 
5                  'April', 'April', 'April', 'April', 'April', 'April', 'April'),
6  duration    = c(36, 44, 45, 48, 50, 50, 51, 54, 55, 57, 60, 60, 60, 60, 30,
7                  40, 44, 47, 47, 47, 53, 53, 54, 55, 56, 57, 69, 77)
8  )
9
10ggplot(df, aes(x = duration, group = monthly_run, color = monthly_run)) + 
11  geom_density() + 
12  theme_minimal()`
13library(ggplot2)
14
15df &lt;- data.frame(y = sin(seq(0, pi, length.out = 100)),
16                 x = seq(0, pi, length.out = 100))
17
18p &lt;- ggplot(df, aes(x, y)) + 
19  geom_line() + 
20  coord_equal() +
21  theme_bw()
22
23p
24label &lt;- &quot;PIRATES VS NINJAS&quot;
25label &lt;- strsplit(label, &quot;&quot;)[[1]]
26next_x_along_sine &lt;- function(x, d)
27{
28  y &lt;- sin(x)
29  uniroot(f = \(b) b^2 + (sin(x + b) - y)^2 - d^2, c(0, 2*pi))$root + x
30}
31  
32x_along_sine &lt;- function(x1, d, n)
33{
34  while(length(x1) &lt; n) x1 &lt;- c(x1, next_x_along_sine(x1[length(x1)], d))
35  x1
36}
37

These allow us to create a little data frame of letters, co-ordinates and angles to plot our letters:

1df &lt;- data.frame(
2  monthly_run = c('March', 'March', 'March', 'March', 'March', 'March', 'March', 
3                  'March', 'March', 'March', 'March', 'March', 'March', 'March', 
4                  'April', 'April', 'April', 'April', 'April', 'April', 'April', 
5                  'April', 'April', 'April', 'April', 'April', 'April', 'April'),
6  duration    = c(36, 44, 45, 48, 50, 50, 51, 54, 55, 57, 60, 60, 60, 60, 30,
7                  40, 44, 47, 47, 47, 53, 53, 54, 55, 56, 57, 69, 77)
8  )
9
10ggplot(df, aes(x = duration, group = monthly_run, color = monthly_run)) + 
11  geom_density() + 
12  theme_minimal()`
13library(ggplot2)
14
15df &lt;- data.frame(y = sin(seq(0, pi, length.out = 100)),
16                 x = seq(0, pi, length.out = 100))
17
18p &lt;- ggplot(df, aes(x, y)) + 
19  geom_line() + 
20  coord_equal() +
21  theme_bw()
22
23p
24label &lt;- &quot;PIRATES VS NINJAS&quot;
25label &lt;- strsplit(label, &quot;&quot;)[[1]]
26next_x_along_sine &lt;- function(x, d)
27{
28  y &lt;- sin(x)
29  uniroot(f = \(b) b^2 + (sin(x + b) - y)^2 - d^2, c(0, 2*pi))$root + x
30}
31  
32x_along_sine &lt;- function(x1, d, n)
33{
34  while(length(x1) &lt; n) x1 &lt;- c(x1, next_x_along_sine(x1[length(x1)], d))
35  x1
36}
37df2 &lt;- as.data.frame(approx(df$x, df$y,  x_along_sine(1, 1/13, length(label))))
38df2$label &lt;- label
39df2$angle &lt;- atan(cos(df2$x)) * 180/pi
40

And now we can plot with plain old geom_text:

1df &lt;- data.frame(
2  monthly_run = c('March', 'March', 'March', 'March', 'March', 'March', 'March', 
3                  'March', 'March', 'March', 'March', 'March', 'March', 'March', 
4                  'April', 'April', 'April', 'April', 'April', 'April', 'April', 
5                  'April', 'April', 'April', 'April', 'April', 'April', 'April'),
6  duration    = c(36, 44, 45, 48, 50, 50, 51, 54, 55, 57, 60, 60, 60, 60, 30,
7                  40, 44, 47, 47, 47, 53, 53, 54, 55, 56, 57, 69, 77)
8  )
9
10ggplot(df, aes(x = duration, group = monthly_run, color = monthly_run)) + 
11  geom_density() + 
12  theme_minimal()`
13library(ggplot2)
14
15df &lt;- data.frame(y = sin(seq(0, pi, length.out = 100)),
16                 x = seq(0, pi, length.out = 100))
17
18p &lt;- ggplot(df, aes(x, y)) + 
19  geom_line() + 
20  coord_equal() +
21  theme_bw()
22
23p
24label &lt;- &quot;PIRATES VS NINJAS&quot;
25label &lt;- strsplit(label, &quot;&quot;)[[1]]
26next_x_along_sine &lt;- function(x, d)
27{
28  y &lt;- sin(x)
29  uniroot(f = \(b) b^2 + (sin(x + b) - y)^2 - d^2, c(0, 2*pi))$root + x
30}
31  
32x_along_sine &lt;- function(x1, d, n)
33{
34  while(length(x1) &lt; n) x1 &lt;- c(x1, next_x_along_sine(x1[length(x1)], d))
35  x1
36}
37df2 &lt;- as.data.frame(approx(df$x, df$y,  x_along_sine(1, 1/13, length(label))))
38df2$label &lt;- label
39df2$angle &lt;- atan(cos(df2$x)) * 180/pi
40p + geom_text(aes(y = y + 0.1, label = label, angle = angle), data = df2,
41              vjust = 1, size = 4, fontface = &quot;bold&quot;)
42

enter image description here

Or, if we want to replace part of the line with text:

1df &lt;- data.frame(
2  monthly_run = c('March', 'March', 'March', 'March', 'March', 'March', 'March', 
3                  'March', 'March', 'March', 'March', 'March', 'March', 'March', 
4                  'April', 'April', 'April', 'April', 'April', 'April', 'April', 
5                  'April', 'April', 'April', 'April', 'April', 'April', 'April'),
6  duration    = c(36, 44, 45, 48, 50, 50, 51, 54, 55, 57, 60, 60, 60, 60, 30,
7                  40, 44, 47, 47, 47, 53, 53, 54, 55, 56, 57, 69, 77)
8  )
9
10ggplot(df, aes(x = duration, group = monthly_run, color = monthly_run)) + 
11  geom_density() + 
12  theme_minimal()`
13library(ggplot2)
14
15df &lt;- data.frame(y = sin(seq(0, pi, length.out = 100)),
16                 x = seq(0, pi, length.out = 100))
17
18p &lt;- ggplot(df, aes(x, y)) + 
19  geom_line() + 
20  coord_equal() +
21  theme_bw()
22
23p
24label &lt;- &quot;PIRATES VS NINJAS&quot;
25label &lt;- strsplit(label, &quot;&quot;)[[1]]
26next_x_along_sine &lt;- function(x, d)
27{
28  y &lt;- sin(x)
29  uniroot(f = \(b) b^2 + (sin(x + b) - y)^2 - d^2, c(0, 2*pi))$root + x
30}
31  
32x_along_sine &lt;- function(x1, d, n)
33{
34  while(length(x1) &lt; n) x1 &lt;- c(x1, next_x_along_sine(x1[length(x1)], d))
35  x1
36}
37df2 &lt;- as.data.frame(approx(df$x, df$y,  x_along_sine(1, 1/13, length(label))))
38df2$label &lt;- label
39df2$angle &lt;- atan(cos(df2$x)) * 180/pi
40p + geom_text(aes(y = y + 0.1, label = label, angle = angle), data = df2,
41              vjust = 1, size = 4, fontface = &quot;bold&quot;)
42df$col &lt;- cut(df$x, c(-1, 0.95, 2.24, 5), c(&quot;black&quot;, &quot;white&quot;, &quot;#000000&quot;))
43
44ggplot(df, aes(x, y)) + 
45  geom_line(aes(color = col, group = col)) + 
46  geom_text(aes(label = label, angle = angle), data = df2,
47            size = 4, fontface = &quot;bold&quot;) +
48  scale_color_identity() +
49  coord_equal() +
50  theme_bw()
51

enter image description here

or, with some theme tweaks:

enter image description here


Addendum

Realistically, I probably won't get round to writing a geom_textpath package, but I thought it would be useful to show the sort of approach that might work for labelling density curves as per the OP's example. It requires the following suite of functions:

1df &lt;- data.frame(
2  monthly_run = c('March', 'March', 'March', 'March', 'March', 'March', 'March', 
3                  'March', 'March', 'March', 'March', 'March', 'March', 'March', 
4                  'April', 'April', 'April', 'April', 'April', 'April', 'April', 
5                  'April', 'April', 'April', 'April', 'April', 'April', 'April'),
6  duration    = c(36, 44, 45, 48, 50, 50, 51, 54, 55, 57, 60, 60, 60, 60, 30,
7                  40, 44, 47, 47, 47, 53, 53, 54, 55, 56, 57, 69, 77)
8  )
9
10ggplot(df, aes(x = duration, group = monthly_run, color = monthly_run)) + 
11  geom_density() + 
12  theme_minimal()`
13library(ggplot2)
14
15df &lt;- data.frame(y = sin(seq(0, pi, length.out = 100)),
16                 x = seq(0, pi, length.out = 100))
17
18p &lt;- ggplot(df, aes(x, y)) + 
19  geom_line() + 
20  coord_equal() +
21  theme_bw()
22
23p
24label &lt;- &quot;PIRATES VS NINJAS&quot;
25label &lt;- strsplit(label, &quot;&quot;)[[1]]
26next_x_along_sine &lt;- function(x, d)
27{
28  y &lt;- sin(x)
29  uniroot(f = \(b) b^2 + (sin(x + b) - y)^2 - d^2, c(0, 2*pi))$root + x
30}
31  
32x_along_sine &lt;- function(x1, d, n)
33{
34  while(length(x1) &lt; n) x1 &lt;- c(x1, next_x_along_sine(x1[length(x1)], d))
35  x1
36}
37df2 &lt;- as.data.frame(approx(df$x, df$y,  x_along_sine(1, 1/13, length(label))))
38df2$label &lt;- label
39df2$angle &lt;- atan(cos(df2$x)) * 180/pi
40p + geom_text(aes(y = y + 0.1, label = label, angle = angle), data = df2,
41              vjust = 1, size = 4, fontface = &quot;bold&quot;)
42df$col &lt;- cut(df$x, c(-1, 0.95, 2.24, 5), c(&quot;black&quot;, &quot;white&quot;, &quot;#000000&quot;))
43
44ggplot(df, aes(x, y)) + 
45  geom_line(aes(color = col, group = col)) + 
46  geom_text(aes(label = label, angle = angle), data = df2,
47            size = 4, fontface = &quot;bold&quot;) +
48  scale_color_identity() +
49  coord_equal() +
50  theme_bw()
51#-----------------------------------------------------------------------
52# Converts a (delta y) / (delta x) gradient to the equivalent
53# angle a letter sitting on that line needs to be rotated by to
54# sit perpendicular to it. Includes a multiplier term so that we
55# can take account of the different scale of x and y variables
56# when plotting, as well as the device's aspect ratio.
57
58gradient_to_text_angle &lt;- function(grad, mult = 1)
59{
60  angle &lt;- atan(mult * grad) * 180 / pi
61}
62
63#-----------------------------------------------------------------------
64# From a given set of x and y co-ordinates, determine the gradient along
65# the path, and also the Euclidean distance along the path. It will also
66# calculate the multiplier needed to correct for differences in the x and
67# y scales as well as the current plotting device's aspect ratio
68
69get_path_data &lt;- function(x, y)
70{
71  grad &lt;- diff(y)/diff(x)
72  multiplier &lt;- diff(range(x))/diff(range(y)) * dev.size()[2] / dev.size()[1]
73  
74  new_x &lt;- (head(x, -1) + tail(x, -1)) / 2
75  new_y &lt;- (head(y, -1) + tail(y, -1)) / 2
76  path_length &lt;- cumsum(sqrt(diff(x)^2 + diff(multiplier * y / 1.5)^2))
77  data.frame(x = new_x, y = new_y, gradient = grad, 
78             angle = gradient_to_text_angle(grad, multiplier), 
79             length = path_length)
80}
81
82#-----------------------------------------------------------------------
83# From a given path data frame as provided by get_path_data, as well
84# as the beginning and ending x co-ordinate, produces the appropriate
85# x, y values and angles for letters placed along the path.
86
87get_path_points &lt;- function(path, x_start, x_end, letters)
88{
89  start_dist &lt;- approx(x = path$x, y = path$length, xout = x_start)$y
90  end_dist &lt;- approx(x = path$x, y = path$length, xout = x_end)$y
91  diff_dist &lt;- end_dist - start_dist
92  letterwidths &lt;- cumsum(strwidth(letters))
93  letterwidths &lt;- letterwidths/sum(strwidth(letters))
94  dist_points &lt;- c(start_dist, letterwidths * diff_dist + start_dist)
95  dist_points &lt;- (head(dist_points, -1) + tail(dist_points, -1))/2
96  x &lt;- approx(x = path$length, y = path$x, xout = dist_points)$y
97  y &lt;- approx(x = path$length, y = path$y, xout = dist_points)$y
98  grad &lt;- approx(x = path$length, y = path$gradient, xout = dist_points)$y
99  angle &lt;- approx(x = path$length, y = path$angle, xout = dist_points)$y
100  data.frame(x = x, y = y, gradient = grad, 
101             angle = angle, length = dist_points)
102}
103
104#-----------------------------------------------------------------------
105# This function combines the other functions to get the appropriate
106# x, y positions and angles for a given string on a given path.
107
108label_to_path &lt;- function(label, path, x_start = head(path$x, 1), 
109                          x_end = tail(path$x, 1)) 
110{
111  letters &lt;- unlist(strsplit(label, &quot;&quot;)[1])
112  df &lt;- get_path_points(path, x_start, x_end, letters)
113  df$letter &lt;- letters
114  df
115}
116
117#-----------------------------------------------------------------------
118# This simple helper function gets the necessary density paths from
119# a given variable. It can be passed a grouping variable to get multiple
120# density paths
121
122get_densities &lt;- function(var, groups)
123{
124  if(missing(groups)) values &lt;- list(var)
125  else values &lt;- split(var, groups)
126  lapply(values, function(x) { 
127    d &lt;- density(x)
128    data.frame(x = d$x, y = d$y)})
129}
130
131#-----------------------------------------------------------------------
132# This is the end-user function to get a data frame of letters spaced
133# out neatly and angled correctly along the density curve of the given
134# variable (with optional grouping)
135
136density_labels &lt;- function(var, groups, proportion = 0.25)
137{
138  d &lt;- get_densities(var, groups)
139  d &lt;- lapply(d, function(x) get_path_data(x$x, x$y))
140  labels &lt;- unique(groups)
141  x_starts &lt;- lapply(d, function(x) x$x[round((length(x$x) * (1 - proportion))/2)])
142  x_ends &lt;- lapply(d, function(x) x$x[round((length(x$x) * (1 + proportion))/2)])
143  do.call(rbind, lapply(seq_along(d), function(i) {
144    df &lt;- label_to_path(labels[i], d[[i]], x_starts[[i]], x_ends[[i]])
145    df$group &lt;- labels[i]
146    df}))
147}
148

With these functions defined, we can now do:

1df &lt;- data.frame(
2  monthly_run = c('March', 'March', 'March', 'March', 'March', 'March', 'March', 
3                  'March', 'March', 'March', 'March', 'March', 'March', 'March', 
4                  'April', 'April', 'April', 'April', 'April', 'April', 'April', 
5                  'April', 'April', 'April', 'April', 'April', 'April', 'April'),
6  duration    = c(36, 44, 45, 48, 50, 50, 51, 54, 55, 57, 60, 60, 60, 60, 30,
7                  40, 44, 47, 47, 47, 53, 53, 54, 55, 56, 57, 69, 77)
8  )
9
10ggplot(df, aes(x = duration, group = monthly_run, color = monthly_run)) + 
11  geom_density() + 
12  theme_minimal()`
13library(ggplot2)
14
15df &lt;- data.frame(y = sin(seq(0, pi, length.out = 100)),
16                 x = seq(0, pi, length.out = 100))
17
18p &lt;- ggplot(df, aes(x, y)) + 
19  geom_line() + 
20  coord_equal() +
21  theme_bw()
22
23p
24label &lt;- &quot;PIRATES VS NINJAS&quot;
25label &lt;- strsplit(label, &quot;&quot;)[[1]]
26next_x_along_sine &lt;- function(x, d)
27{
28  y &lt;- sin(x)
29  uniroot(f = \(b) b^2 + (sin(x + b) - y)^2 - d^2, c(0, 2*pi))$root + x
30}
31  
32x_along_sine &lt;- function(x1, d, n)
33{
34  while(length(x1) &lt; n) x1 &lt;- c(x1, next_x_along_sine(x1[length(x1)], d))
35  x1
36}
37df2 &lt;- as.data.frame(approx(df$x, df$y,  x_along_sine(1, 1/13, length(label))))
38df2$label &lt;- label
39df2$angle &lt;- atan(cos(df2$x)) * 180/pi
40p + geom_text(aes(y = y + 0.1, label = label, angle = angle), data = df2,
41              vjust = 1, size = 4, fontface = &quot;bold&quot;)
42df$col &lt;- cut(df$x, c(-1, 0.95, 2.24, 5), c(&quot;black&quot;, &quot;white&quot;, &quot;#000000&quot;))
43
44ggplot(df, aes(x, y)) + 
45  geom_line(aes(color = col, group = col)) + 
46  geom_text(aes(label = label, angle = angle), data = df2,
47            size = 4, fontface = &quot;bold&quot;) +
48  scale_color_identity() +
49  coord_equal() +
50  theme_bw()
51#-----------------------------------------------------------------------
52# Converts a (delta y) / (delta x) gradient to the equivalent
53# angle a letter sitting on that line needs to be rotated by to
54# sit perpendicular to it. Includes a multiplier term so that we
55# can take account of the different scale of x and y variables
56# when plotting, as well as the device's aspect ratio.
57
58gradient_to_text_angle &lt;- function(grad, mult = 1)
59{
60  angle &lt;- atan(mult * grad) * 180 / pi
61}
62
63#-----------------------------------------------------------------------
64# From a given set of x and y co-ordinates, determine the gradient along
65# the path, and also the Euclidean distance along the path. It will also
66# calculate the multiplier needed to correct for differences in the x and
67# y scales as well as the current plotting device's aspect ratio
68
69get_path_data &lt;- function(x, y)
70{
71  grad &lt;- diff(y)/diff(x)
72  multiplier &lt;- diff(range(x))/diff(range(y)) * dev.size()[2] / dev.size()[1]
73  
74  new_x &lt;- (head(x, -1) + tail(x, -1)) / 2
75  new_y &lt;- (head(y, -1) + tail(y, -1)) / 2
76  path_length &lt;- cumsum(sqrt(diff(x)^2 + diff(multiplier * y / 1.5)^2))
77  data.frame(x = new_x, y = new_y, gradient = grad, 
78             angle = gradient_to_text_angle(grad, multiplier), 
79             length = path_length)
80}
81
82#-----------------------------------------------------------------------
83# From a given path data frame as provided by get_path_data, as well
84# as the beginning and ending x co-ordinate, produces the appropriate
85# x, y values and angles for letters placed along the path.
86
87get_path_points &lt;- function(path, x_start, x_end, letters)
88{
89  start_dist &lt;- approx(x = path$x, y = path$length, xout = x_start)$y
90  end_dist &lt;- approx(x = path$x, y = path$length, xout = x_end)$y
91  diff_dist &lt;- end_dist - start_dist
92  letterwidths &lt;- cumsum(strwidth(letters))
93  letterwidths &lt;- letterwidths/sum(strwidth(letters))
94  dist_points &lt;- c(start_dist, letterwidths * diff_dist + start_dist)
95  dist_points &lt;- (head(dist_points, -1) + tail(dist_points, -1))/2
96  x &lt;- approx(x = path$length, y = path$x, xout = dist_points)$y
97  y &lt;- approx(x = path$length, y = path$y, xout = dist_points)$y
98  grad &lt;- approx(x = path$length, y = path$gradient, xout = dist_points)$y
99  angle &lt;- approx(x = path$length, y = path$angle, xout = dist_points)$y
100  data.frame(x = x, y = y, gradient = grad, 
101             angle = angle, length = dist_points)
102}
103
104#-----------------------------------------------------------------------
105# This function combines the other functions to get the appropriate
106# x, y positions and angles for a given string on a given path.
107
108label_to_path &lt;- function(label, path, x_start = head(path$x, 1), 
109                          x_end = tail(path$x, 1)) 
110{
111  letters &lt;- unlist(strsplit(label, &quot;&quot;)[1])
112  df &lt;- get_path_points(path, x_start, x_end, letters)
113  df$letter &lt;- letters
114  df
115}
116
117#-----------------------------------------------------------------------
118# This simple helper function gets the necessary density paths from
119# a given variable. It can be passed a grouping variable to get multiple
120# density paths
121
122get_densities &lt;- function(var, groups)
123{
124  if(missing(groups)) values &lt;- list(var)
125  else values &lt;- split(var, groups)
126  lapply(values, function(x) { 
127    d &lt;- density(x)
128    data.frame(x = d$x, y = d$y)})
129}
130
131#-----------------------------------------------------------------------
132# This is the end-user function to get a data frame of letters spaced
133# out neatly and angled correctly along the density curve of the given
134# variable (with optional grouping)
135
136density_labels &lt;- function(var, groups, proportion = 0.25)
137{
138  d &lt;- get_densities(var, groups)
139  d &lt;- lapply(d, function(x) get_path_data(x$x, x$y))
140  labels &lt;- unique(groups)
141  x_starts &lt;- lapply(d, function(x) x$x[round((length(x$x) * (1 - proportion))/2)])
142  x_ends &lt;- lapply(d, function(x) x$x[round((length(x$x) * (1 + proportion))/2)])
143  do.call(rbind, lapply(seq_along(d), function(i) {
144    df &lt;- label_to_path(labels[i], d[[i]], x_starts[[i]], x_ends[[i]])
145    df$group &lt;- labels[i]
146    df}))
147}
148set.seed(100)
149
150df &lt;- data.frame(value = rpois(100, 3),
151                 group = rep(paste(&quot;This is a very long label&quot;,
152                                   &quot;that will nicely demonstrate the ability&quot;,
153                                   &quot;of text to follow a density curve&quot;), 100))
154
155ggplot(df, aes(value)) + 
156  geom_density(fill = &quot;forestgreen&quot;, color = NA, alpha = 0.2) +
157  geom_text(aes(x = x, y = y, label = letter, angle = angle), 
158            data = density_labels(df$value, df$group, 0.8)) +
159  theme_bw() 
160

enter image description here

Source https://stackoverflow.com/questions/69867669

Community Discussions contain sources that include Stack Exchange Network

Tutorials and Learning Resources in R

Tutorials and Learning Resources are not available at this moment for R

Share this Page

share link

Get latest updates on R