Explore all Logging open source software, libraries, packages, source code, cloud functions and APIs.

Popular New Releases in Logging

No Popular Releases are available at this moment for Logging

Popular Libraries in Logging

No Trending Libraries are available at this moment for Logging

Trending New libraries in Logging

No Trending Libraries are available at this moment for Logging

Top Authors in Logging

No Top Authors are available at this moment for Logging.

Trending Kits in Logging

Ruby is a dynamic, reflective, object-oriented programming language. It was created by Yukihiro Matsumoto in Japan. Ruby was designed to be simple to learn and easy to use. It has a minimal syntax and relies on "gems" to add complexity to the language. Logging is a crucial part of any application. It helps to understand how the application is behaving, which allows us to take appropriate actions at the right time. Ruby Logging libraries are a set of libraries that help to write logs in the application. Ruby Logging is a standard for logging in Ruby. It's used by default in Rails and Sinatra, but can be used in any Ruby application. It provides functionality like colorized output, formatting of log messages and rotating files. Popular Ruby Logging open source libraries for developers include: logstash - Logstash transport and process your logs, events, or other data; fluentd - Fluentd: Unified Logging Layer; github-changelog-generator - Automatically generate change log.

Python is a programming language used for general-purpose programming, scripting and data science applications. Python has been around since the late 1980s and was designed by Guido van Rossum at the National Research Institute for Mathematics and Computer Science in the Netherlands. Python is a very popular and powerful language. Python programmers are always looking for ways to make their code more efficient, readable, and easier to maintain. Python Logging is the standard Python library for logging. It provides a simple and effective way to add logging to the Python applications. A logging library is a piece of software that allows programmers to record information about the behavior of their program. A few of the most popular Python Logging open source libraries for developers are: loguru - Python logging made simple; python-json-logger - Json Formatter for the standard python logger; fluent-logger-python - A structured logger for Fluentd.

JavaScript logging libraries are used to log information in the browser. These libraries can be used to log information such as the user’s browser version, network connection type, and other environment details. Logging is a way to track and monitor the activities or any events that are happening in the application. Logs are also useful for debugging, monitoring, and troubleshooting. A log is one of the most important tools for debugging and tracking errors in web applications. JavaScript logging libraries not only provide a way to add logs to the code but also provide customizing options that allow to customize the log messages. Some of the most widely used open source libraries for JavaScript Logging among developers include: winston - A logger for just about everything; pino - super fast, all natural json logger; signale - Highly configurable logging utility.

C# Logging libraries are a very important part of any software application. They are used by developers to track the progress of an application and to find out what went wrong. Logging is a necessary part of any software application, but it can be time-consuming and tedious to write the own logging code. It helps to monitor the behavior and performance of the app, as well as help in debugging errors. It helps to debug and troubleshoot the errors in the application. It also helps in identifying performance issues and bugs that might occur in the application. Developers tend to use some of the following C# Logging open source libraries are: NLog - Structured Logging for Various .NET Platforms; serilog - Simple .NET logging with fullystructured events; DiscordChatExporter - Exports Discord chat logs to a file.

Logging is a process of recording the events or actions taken by a computer program in a log file for future use. A log file is usually a text file that records events chronologically, so that they can be reviewed at any time by the software operator. Logs can be used to monitor and debug applications. They can also be used to provide information to interested parties such as administrators, developers or users. It helps to keep track of what's going on in the code and provides a way to debug problems. PHP Logging libraries are one of the most important parts of a PHP application to ensure that the code is running smoothly and can be debugged when problems occur. Logging helps to keep track of the performance of applications, systems and network activities. Popular PHP Logging open source libraries among developers include: monolog - Sends your logs to files, sockets, inboxes, databases and various web services; laravel-log-viewer - Laravel log viewer; easy-log-handler - Humanfriendly log files that make you more productive.

Go programming language is a modern, general-purpose language that can be used to build a wide range of applications. It has been around since 2009 and is actively developed by Google. Go has become increasingly popular over the last few years because of its excellent performance and flexibility. It is an expressive language with C-like syntax that compiles down to machine code and runs very fast due to its static type checking. Go has a rich set of libraries, which makes it easy for developers to build applications quickly. Logging is an important aspect of any software application. It helps to debug and monitor the application’s behavior, as well as monitor how it’s performing. Many developers depend on the following Go Logging open source libraries are: logrus - Structured, pluggable logging for Go; loki - Like Prometheus, but for logs; zap | Blazing fast, structured, leveled logging in Go.

Trending Discussions on Logging

CentOS through a VM - no URLs in mirrorlist

Springboot 2.6.0 / Spring fox 3 - Failed to start bean 'documentationPluginsBootstrapper'

Components not included in Strapi api response

Failed to load next.config.js

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

One or more issues found when checking AAR metadata values:

Android Build Error: "lStar not found..."

Could not resolve com.google.guava:guava:30.1-jre - Gradle project sync failed. Basic functionality will not work properly - in kotlin project

pip-compile raising AssertionError on its logging handler

How to perform logging in ConfigureServices method of Startup.cs in ASP.NET Core 5.0

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

Springboot 2.6.0 / Spring fox 3 - Failed to start bean 'documentationPluginsBootstrapper'

Asked 2022-Mar-25 at 06:14

I'm trying to initiate a Springboot project using Open Jdk 15, Springboot 2.6.0, Springfox 3. We are working on a project that replaced Netty as the webserver and used Jetty instead because we do not need a non-blocking environment.

In the code we depend primarily on Reactor API (Flux, Mono), so we can not remove org.springframework.boot:spring-boot-starter-webflux dependencies.

I replicated the problem that we have in a new project.: https://github.com/jvacaq/spring-fox.

I figured out that these lines in our build.gradle file are the origin of the problem.

1compile("org.springframework.boot:spring-boot-starter-web") {
2   exclude module: "spring-boot-starter-tomcat"
3}
4compile("org.springframework.boot:spring-boot-starter-jetty")
5

Here is the build.gradle file:

1compile("org.springframework.boot:spring-boot-starter-web") {
2   exclude module: "spring-boot-starter-tomcat"
3}
4compile("org.springframework.boot:spring-boot-starter-jetty")
5plugins {
6    id 'org.springframework.boot' version '2.6.0'
7    id 'io.spring.dependency-management' version '1.0.11.RELEASE'
8    id 'java'
9}
10
11group = 'com.example'
12version = '0.0.1-SNAPSHOT'
13sourceCompatibility = '11'
14
15repositories {
16    mavenCentral()
17}
18
19dependencies {
20    compile("org.springframework.boot:spring-boot-starter-web") {
21        exclude module: "spring-boot-starter-tomcat"
22    }
23    compile("org.springframework.boot:spring-boot-starter-jetty")
24    implementation 'org.springframework.boot:spring-boot-starter-webflux'
25    testImplementation 'org.springframework.boot:spring-boot-starter-test'
26    testImplementation 'io.projectreactor:reactor-test'
27    implementation "io.springfox:springfox-boot-starter:3.0.0"
28}
29
30test {
31    useJUnitPlatform()
32}
33
34

I issued the command gradle clean bootrun. The result is this error:

1compile("org.springframework.boot:spring-boot-starter-web") {
2   exclude module: "spring-boot-starter-tomcat"
3}
4compile("org.springframework.boot:spring-boot-starter-jetty")
5plugins {
6    id 'org.springframework.boot' version '2.6.0'
7    id 'io.spring.dependency-management' version '1.0.11.RELEASE'
8    id 'java'
9}
10
11group = 'com.example'
12version = '0.0.1-SNAPSHOT'
13sourceCompatibility = '11'
14
15repositories {
16    mavenCentral()
17}
18
19dependencies {
20    compile("org.springframework.boot:spring-boot-starter-web") {
21        exclude module: "spring-boot-starter-tomcat"
22    }
23    compile("org.springframework.boot:spring-boot-starter-jetty")
24    implementation 'org.springframework.boot:spring-boot-starter-webflux'
25    testImplementation 'org.springframework.boot:spring-boot-starter-test'
26    testImplementation 'io.projectreactor:reactor-test'
27    implementation "io.springfox:springfox-boot-starter:3.0.0"
28}
29
30test {
31    useJUnitPlatform()
32}
33
34 gradle clean bootrun                                                                                                                                                                                                               
35
36> Task :bootRun FAILED
37
38  .   ____          _            __ _ _
39 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
40( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
41 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
42  '  |____| .__|_| |_|_| |_\__, | / / / /
43 =========|_|==============|___/=/_/_/_/
44 :: Spring Boot ::                (v2.6.0)
45
462021-11-19 09:41:06.665  INFO 16666 --- [           main] c.e.springfox.SpringFoxApplication       : Starting SpringFoxApplication using Java 15.0.2 on advance-Inspiron-5379 with PID 16666 (/home/advance/projects/spring-fox/build/classes/java/main started by advance in /home/advance/projects/spring-fox)
472021-11-19 09:41:06.666  INFO 16666 --- [           main] c.e.springfox.SpringFoxApplication       : No active profile set, falling back to default profiles: default
482021-11-19 09:41:07.294  INFO 16666 --- [           main] org.eclipse.jetty.util.log               : Logging initialized @1132ms to org.eclipse.jetty.util.log.Slf4jLog
492021-11-19 09:41:07.396  INFO 16666 --- [           main] o.s.b.w.e.j.JettyServletWebServerFactory : Server initialized with port: 8080
502021-11-19 09:41:07.398  INFO 16666 --- [           main] org.eclipse.jetty.server.Server          : jetty-9.4.44.v20210927; built: 2021-09-27T23:02:44.612Z; git: 8da83308eeca865e495e53ef315a249d63ba9332; jvm 15.0.2+7-27
512021-11-19 09:41:07.417  INFO 16666 --- [           main] o.e.j.s.h.ContextHandler.application     : Initializing Spring embedded WebApplicationContext
522021-11-19 09:41:07.417  INFO 16666 --- [           main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 713 ms
532021-11-19 09:41:07.474  INFO 16666 --- [           main] org.eclipse.jetty.server.session         : DefaultSessionIdManager workerName=node0
542021-11-19 09:41:07.474  INFO 16666 --- [           main] org.eclipse.jetty.server.session         : No SessionScavenger set, using defaults
552021-11-19 09:41:07.475  INFO 16666 --- [           main] org.eclipse.jetty.server.session         : node0 Scavenging every 660000ms
562021-11-19 09:41:07.480  INFO 16666 --- [           main] o.e.jetty.server.handler.ContextHandler  : Started o.s.b.w.e.j.JettyEmbeddedWebAppContext@6aa3bfc{application,/,[file:///tmp/jetty-docbase.8080.2024342829220941812/, jar:file:/home/advance/.gradle/caches/modules-2/files-2.1/io.springfox/springfox-swagger-ui/3.0.0/1e665fbe22148f7c36fa8a08e515a0047cd4390b/springfox-swagger-ui-3.0.0.jar!/META-INF/resources],AVAILABLE}
572021-11-19 09:41:07.480  INFO 16666 --- [           main] org.eclipse.jetty.server.Server          : Started @1318ms
582021-11-19 09:41:07.920  INFO 16666 --- [           main] o.e.j.s.h.ContextHandler.application     : Initializing Spring DispatcherServlet 'dispatcherServlet'
592021-11-19 09:41:07.920  INFO 16666 --- [           main] o.s.web.servlet.DispatcherServlet        : Initializing Servlet 'dispatcherServlet'
602021-11-19 09:41:07.921  INFO 16666 --- [           main] o.s.web.servlet.DispatcherServlet        : Completed initialization in 1 ms
612021-11-19 09:41:07.931  INFO 16666 --- [           main] o.e.jetty.server.AbstractConnector       : Started ServerConnector@2643d762{HTTP/1.1, (http/1.1)}{0.0.0.0:8080}
622021-11-19 09:41:07.932  INFO 16666 --- [           main] o.s.b.web.embedded.jetty.JettyWebServer  : Jetty started on port(s) 8080 (http/1.1) with context path '/'
632021-11-19 09:41:07.934  WARN 16666 --- [           main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Failed to start bean 'documentationPluginsBootstrapper'; nested exception is java.lang.NullPointerException: Cannot invoke "org.springframework.web.servlet.mvc.condition.PatternsRequestCondition.getPatterns()" because "this.condition" is null
642021-11-19 09:41:07.949  INFO 16666 --- [           main] o.e.jetty.server.AbstractConnector       : Stopped ServerConnector@2643d762{HTTP/1.1, (http/1.1)}{0.0.0.0:8080}
652021-11-19 09:41:07.950  INFO 16666 --- [           main] org.eclipse.jetty.server.session         : node0 Stopped scavenging
662021-11-19 09:41:07.951  INFO 16666 --- [           main] o.e.j.s.h.ContextHandler.application     : Destroying Spring FrameworkServlet 'dispatcherServlet'
672021-11-19 09:41:07.951  INFO 16666 --- [           main] o.e.jetty.server.handler.ContextHandler  : Stopped o.s.b.w.e.j.JettyEmbeddedWebAppContext@6aa3bfc{application,/,[file:///tmp/jetty-docbase.8080.2024342829220941812/, jar:file:/home/advance/.gradle/caches/modules-2/files-2.1/io.springfox/springfox-swagger-ui/3.0.0/1e665fbe22148f7c36fa8a08e515a0047cd4390b/springfox-swagger-ui-3.0.0.jar!/META-INF/resources],STOPPED}
682021-11-19 09:41:07.958  INFO 16666 --- [           main] ConditionEvaluationReportLoggingListener : 
69
70Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
712021-11-19 09:41:07.970 ERROR 16666 --- [           main] o.s.boot.SpringApplication               : Application run failed
72
73org.springframework.context.ApplicationContextException: Failed to start bean 'documentationPluginsBootstrapper'; nested exception is java.lang.NullPointerException: Cannot invoke "org.springframework.web.servlet.mvc.condition.PatternsRequestCondition.getPatterns()" because "this.condition" is null
74        at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:181) ~[spring-context-5.3.13.jar:5.3.13]
75        at org.springframework.context.support.DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor.java:54) ~[spring-context-5.3.13.jar:5.3.13]
76        at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:356) ~[spring-context-5.3.13.jar:5.3.13]
77        at java.base/java.lang.Iterable.forEach(Iterable.java:75) ~[na:na]
78        at org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:155) ~[spring-context-5.3.13.jar:5.3.13]
79        at org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:123) ~[spring-context-5.3.13.jar:5.3.13]
80        at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:935) ~[spring-context-5.3.13.jar:5.3.13]
81        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:586) ~[spring-context-5.3.13.jar:5.3.13]
82        at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145) ~[spring-boot-2.6.0.jar:2.6.0]
83        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:730) ~[spring-boot-2.6.0.jar:2.6.0]
84        at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:412) ~[spring-boot-2.6.0.jar:2.6.0]
85        at org.springframework.boot.SpringApplication.run(SpringApplication.java:302) ~[spring-boot-2.6.0.jar:2.6.0]
86        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1301) ~[spring-boot-2.6.0.jar:2.6.0]
87        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1290) ~[spring-boot-2.6.0.jar:2.6.0]
88        at com.example.springfox.SpringFoxApplication.main(SpringFoxApplication.java:10) ~[main/:na]
89Caused by: java.lang.NullPointerException: Cannot invoke "org.springframework.web.servlet.mvc.condition.PatternsRequestCondition.getPatterns()" because "this.condition" is null
90        at springfox.documentation.spring.web.WebMvcPatternsRequestConditionWrapper.getPatterns(WebMvcPatternsRequestConditionWrapper.java:56) ~[springfox-spring-webmvc-3.0.0.jar:3.0.0]
91        at springfox.documentation.RequestHandler.sortedPaths(RequestHandler.java:113) ~[springfox-core-3.0.0.jar:3.0.0]
92        at springfox.documentation.spi.service.contexts.Orderings.lambda$byPatternsCondition$3(Orderings.java:89) ~[springfox-spi-3.0.0.jar:3.0.0]
93        at java.base/java.util.Comparator.lambda$comparing$77a9974f$1(Comparator.java:469) ~[na:na]
94        at java.base/java.util.TimSort.countRunAndMakeAscending(TimSort.java:355) ~[na:na]
95        at java.base/java.util.TimSort.sort(TimSort.java:220) ~[na:na]
96        at java.base/java.util.Arrays.sort(Arrays.java:1306) ~[na:na]
97        at java.base/java.util.ArrayList.sort(ArrayList.java:1721) ~[na:na]
98        at java.base/java.util.stream.SortedOps$RefSortingSink.end(SortedOps.java:392) ~[na:na]
99        at java.base/java.util.stream.Sink$ChainedReference.end(Sink.java:258) ~[na:na]
100        at java.base/java.util.stream.Sink$ChainedReference.end(Sink.java:258) ~[na:na]
101        at java.base/java.util.stream.Sink$ChainedReference.end(Sink.java:258) ~[na:na]
102        at java.base/java.util.stream.Sink$ChainedReference.end(Sink.java:258) ~[na:na]
103        at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:485) ~[na:na]
104        at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474) ~[na:na]
105        at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913) ~[na:na]
106        at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[na:na]
107        at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578) ~[na:na]
108        at springfox.documentation.spring.web.plugins.WebMvcRequestHandlerProvider.requestHandlers(WebMvcRequestHandlerProvider.java:81) ~[springfox-spring-webmvc-3.0.0.jar:3.0.0]
109        at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195) ~[na:na]
110        at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1625) ~[na:na]
111        at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484) ~[na:na]
112        at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474) ~[na:na]
113        at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913) ~[na:na]
114        at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[na:na]
115        at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578) ~[na:na]
116        at springfox.documentation.spring.web.plugins.AbstractDocumentationPluginsBootstrapper.withDefaults(AbstractDocumentationPluginsBootstrapper.java:107) ~[springfox-spring-web-3.0.0.jar:3.0.0]
117        at springfox.documentation.spring.web.plugins.AbstractDocumentationPluginsBootstrapper.buildContext(AbstractDocumentationPluginsBootstrapper.java:91) ~[springfox-spring-web-3.0.0.jar:3.0.0]
118        at springfox.documentation.spring.web.plugins.AbstractDocumentationPluginsBootstrapper.bootstrapDocumentationPlugins(AbstractDocumentationPluginsBootstrapper.java:82) ~[springfox-spring-web-3.0.0.jar:3.0.0]
119        at springfox.documentation.spring.web.plugins.DocumentationPluginsBootstrapper.start(DocumentationPluginsBootstrapper.java:100) ~[springfox-spring-web-3.0.0.jar:3.0.0]
120        at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:178) ~[spring-context-5.3.13.jar:5.3.13]
121        ... 14 common frames omitted
122
123
124FAILURE: Build failed with an exception.
125
126* What went wrong:
127Execution failed for task ':bootRun'.
128> Process 'command '/home/advance/.sdkman/candidates/java/15.0.2-open/bin/java'' finished with non-zero exit value 1
129
130* Try:
131Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
132
133* Get more help at https://help.gradle.org
134
135Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
136Use '--warning-mode all' to show the individual deprecation warnings.
137See https://docs.gradle.org/6.9.1/userguide/command_line_interface.html#sec:command_line_warnings
138
139BUILD FAILED in 2s
1405 actionable tasks: 5 executed
141

Does anyone have an idea how to solve it?

ANSWER

Answered 2022-Feb-08 at 12:36

This problem's caused by a bug in Springfox. It's making an assumption about how Spring MVC is set up that doesn't always hold true. Specifically, it's assuming that MVC's path matching will use the Ant-based path matcher and not the PathPattern-based matcher. PathPattern-based matching has been an option for some time now and is the default as of Spring Boot 2.6.

As described in Spring Boot 2.6's release notes, you can restore the configuration that Springfox assumes will be used by setting spring.mvc.pathmatch.matching-strategy to ant-path-matcher in your application.properties file. Note that this will only work if you are not using Spring Boot's Actuator. The Actuator always uses PathPattern-based parsing, irrespective of the configured matching-strategy. A change to Springfox will be required if you want to use it with the Actuator in Spring Boot 2.6 and later.

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

QUESTION

Components not included in Strapi api response

Asked 2022-Mar-19 at 16:49

I decided today that I'm going to use Strapi as my headless CMS for my portfolio, I've bumped into some issues though, which I just seem to not be able to find a solution to online. Maybe I'm just too clueless to actually find the real issue.

I have set up a schema for my projects that will be stored in Strapi (everything done in the web), but I've had some issues with my custom components, and that is, they are not part of the API responses when I run it through Postman. (Not just empty keys but not included in the response at all). All other fields, that are not components, are filled out as expected.

At first I thought it might have to do with the permissions, but everything is enabled so it can't be that, I also tried looking into the API in the code, but that logging the answer there didn't include the components either.

Here is an image of some of the fields in the schema, but more importantly the components that are not included in the response.

Some of the fields

So my question is, do I need to create some sort of a parser or anything in the project to be able to include these fields, or why are they not included?

ANSWER

Answered 2021-Dec-06 at 20:22

I had the same problem and was able to fix it by adding populate=* to the end of the API endpoint.

For example:

1http://localhost:1337/api/test?populate=*
2

More info here: https://forum.strapi.io/t/cannot-see-media-field-in-my-endpoint-for-my-content-type/13082/2

edit: Only first-level relations are populated with populate=* . Use the LHS bracket syntax (i.e. [populate]=*) to populate deeper:

For example:

1http://localhost:1337/api/test?populate=*
2http://localhost:1337/api/test?populate[TestExamples][populate]=*
3

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

QUESTION

Failed to load next.config.js

Asked 2022-Mar-11 at 12:03

After cloning the repository I created and set my .env.local file, ran npm i then ran npm run dev. The server starts, env is loaded from .env.local however it immediately fails prompting me with the following:

1error - Failed to load next.config.js, see more info here https://nextjs.org/docs/messages/next-config-error
2Error: Not supported
3    at Object.loadConfig [as default] (C:\Users\Nick\Desktop\rebuild\node_modules\next\dist\server\config.js:399:74)
4    at async NextServer.loadConfig (C:\Users\Nick\Desktop\rebuild\node_modules\next\dist\server\next.js:110:22)
5    at async NextServer.prepare (C:\Users\Nick\Desktop\rebuild\node_modules\next\dist\server\next.js:92:24)
6    at async C:\Users\Nick\Desktop\rebuild\node_modules\next\dist\cli\next-dev.js:126:9
7npm ERR! code ELIFECYCLE
8npm ERR! errno 1
9npm ERR! rebuild@0.1.0 dev: `next dev`
10npm ERR! Exit status 1
11npm ERR!
12npm ERR! Failed at the rebuild@0.1.0 dev script.
13npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
14
15npm ERR! A complete log of this run can be found in:
16npm ERR!     C:\Users\Nick\AppData\Roaming\npm-cache\_logs\2021-10-29T19_47_30_427Z-debug.log
17

The NextJS documentation says: See the error message in your terminal where you started next to see more context. however all it is telling me is Not Supported.

I'm not familiar with the error and was looking for guidance.

ANSWER

Answered 2021-Oct-30 at 20:21

I solved this by upgrading to the latest version of nodeJS

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

QUESTION

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

My second manifest file:

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

My gradle file:

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

One or more issues found when checking AAR metadata values:

Asked 2022-Feb-18 at 17:01

Hey I am trying to run my application and I am getting this error

build.gradle

1plugins {
2    id 'com.android.application'
3    id 'kotlin-android'
4    id 'kotlin-kapt'
5}
6
7android {
8    compileSdk 30
9
10    configurations.all {
11        resolutionStrategy { force 'androidx.core:core-ktx:1.7.0-alpha01' }
12    }
13
14    defaultConfig {
15
16        applicationId "com.example.listadapter"
17        minSdk 21
18        targetSdk 30
19        versionCode 1
20        versionName "1.0"
21
22        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
23    }
24
25    buildTypes {
26        release {
27            minifyEnabled false
28            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
29        }
30    }
31    compileOptions {
32        sourceCompatibility JavaVersion.VERSION_1_8
33        targetCompatibility JavaVersion.VERSION_1_8
34    }
35    kotlinOptions {
36        jvmTarget = '1.8'
37    }
38
39    buildFeatures {
40        viewBinding true
41    }
42}
43
44dependencies {
45
46    implementation 'androidx.core:core-ktx:1.7.0'
47    implementation 'androidx.appcompat:appcompat:1.3.1'
48    implementation 'com.google.android.material:material:1.4.0'
49    implementation 'androidx.constraintlayout:constraintlayout:2.1.1'
50    testImplementation 'junit:junit:4.+'
51    androidTestImplementation 'androidx.test.ext:junit:1.1.3'
52    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
53
54    implementation "com.squareup.retrofit2:converter-moshi:2.5.0"
55    implementation 'com.squareup.okhttp3:logging-interceptor:4.9.1'
56    implementation 'com.squareup.retrofit2:retrofit:2.9.0'
57
58    implementation "com.squareup.moshi:moshi:1.12.0"
59    implementation "com.squareup.moshi:moshi-kotlin:1.12.0"
60
61    implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.0"
62    implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.4.0"
63    implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.4.0"
64    implementation "android.arch.lifecycle:extensions:1.1.1"
65    implementation 'androidx.fragment:fragment-ktx:1.3.6'
66}
67

I tried this All Example from this link it's not working

getting error after installing the application. I just created a new application. I don't understand why this is causing it. Does anyone know how to solve this problem? Thanks in adavance.

1plugins {
2    id 'com.android.application'
3    id 'kotlin-android'
4    id 'kotlin-kapt'
5}
6
7android {
8    compileSdk 30
9
10    configurations.all {
11        resolutionStrategy { force 'androidx.core:core-ktx:1.7.0-alpha01' }
12    }
13
14    defaultConfig {
15
16        applicationId "com.example.listadapter"
17        minSdk 21
18        targetSdk 30
19        versionCode 1
20        versionName "1.0"
21
22        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
23    }
24
25    buildTypes {
26        release {
27            minifyEnabled false
28            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
29        }
30    }
31    compileOptions {
32        sourceCompatibility JavaVersion.VERSION_1_8
33        targetCompatibility JavaVersion.VERSION_1_8
34    }
35    kotlinOptions {
36        jvmTarget = '1.8'
37    }
38
39    buildFeatures {
40        viewBinding true
41    }
42}
43
44dependencies {
45
46    implementation 'androidx.core:core-ktx:1.7.0'
47    implementation 'androidx.appcompat:appcompat:1.3.1'
48    implementation 'com.google.android.material:material:1.4.0'
49    implementation 'androidx.constraintlayout:constraintlayout:2.1.1'
50    testImplementation 'junit:junit:4.+'
51    androidTestImplementation 'androidx.test.ext:junit:1.1.3'
52    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
53
54    implementation "com.squareup.retrofit2:converter-moshi:2.5.0"
55    implementation 'com.squareup.okhttp3:logging-interceptor:4.9.1'
56    implementation 'com.squareup.retrofit2:retrofit:2.9.0'
57
58    implementation "com.squareup.moshi:moshi:1.12.0"
59    implementation "com.squareup.moshi:moshi-kotlin:1.12.0"
60
61    implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.0"
62    implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.4.0"
63    implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.4.0"
64    implementation "android.arch.lifecycle:extensions:1.1.1"
65    implementation 'androidx.fragment:fragment-ktx:1.3.6'
66}
67One or more issues found when checking AAR metadata values:
68
69The minCompileSdk (31) specified in a
70dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties)
71is greater than this module's compileSdkVersion (android-30).
72Dependency: androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.0.
73AAR metadata file: /Users/vmodi/.gradle/caches/transforms-3/b7f9608e476cb2e496993f185af8912c/transformed/jetified-lifecycle-viewmodel-ktx-2.4.0/META-INF/com/android/build/gradle/aar-metadata.properties.
74
75The minCompileSdk (31) specified in a
76dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties)
77is greater than this module's compileSdkVersion (android-30).
78Dependency: androidx.lifecycle:lifecycle-runtime-ktx:2.4.0.
79AAR metadata file: /Users/vmodi/.gradle/caches/transforms-3/538fea46e89a6c8a3e3eec533224abb8/transformed/jetified-lifecycle-runtime-ktx-2.4.0/META-INF/com/android/build/gradle/aar-metadata.properties.
80
81The minCompileSdk (31) specified in a
82dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties)
83is greater than this module's compileSdkVersion (android-30).
84Dependency: androidx.lifecycle:lifecycle-livedata-ktx:2.4.0.
85AAR metadata file: /Users/vmodi/.gradle/caches/transforms-3/6a1f77e99280b09902894e4ae8301047/transformed/jetified-lifecycle-livedata-ktx-2.4.0/META-INF/com/android/build/gradle/aar-metadata.properties.
86
87The minCompileSdk (31) specified in a
88dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties)
89is greater than this module's compileSdkVersion (android-30).
90Dependency: androidx.lifecycle:lifecycle-viewmodel:2.4.0.
91AAR metadata file: /Users/vmodi/.gradle/caches/transforms-3/41cf6125c3fd7a33d28222cf07d20520/transformed/lifecycle-viewmodel-2.4.0/META-INF/com/android/build/gradle/aar-metadata.properties.
92
93The minCompileSdk (31) specified in a
94dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties)
95is greater than this module's compileSdkVersion (android-30).
96Dependency: androidx.lifecycle:lifecycle-runtime:2.4.0.
97AAR metadata file: /Users/vmodi/.gradle/caches/transforms-3/655163560a267a5b16e2f66044d78641/transformed/lifecycle-runtime-2.4.0/META-INF/com/android/build/gradle/aar-metadata.properties.
98
99The minCompileSdk (31) specified in a
100dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties)
101is greater than this module's compileSdkVersion (android-30).
102Dependency: androidx.lifecycle:lifecycle-livedata:2.4.0.
103AAR metadata file: /Users/vmodi/.gradle/caches/transforms-3/1ca84d966e72f2f06b580da1765a55a5/transformed/lifecycle-livedata-2.4.0/META-INF/com/android/build/gradle/aar-metadata.properties.
104
105The minCompileSdk (31) specified in a
106dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties)
107is greater than this module's compileSdkVersion (android-30).
108Dependency: androidx.lifecycle:lifecycle-livedata-core-ktx:2.4.0.
109AAR metadata file: /Users/vmodi/.gradle/caches/transforms-3/3ed4d52253be7f6d85cbabee72c886d3/transformed/jetified-lifecycle-livedata-core-ktx-2.4.0/META-INF/com/android/build/gradle/aar-metadata.properties.
110
111The minCompileSdk (31) specified in a
112dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties)
113is greater than this module's compileSdkVersion (android-30).
114Dependency: androidx.lifecycle:lifecycle-livedata-core:2.4.0.
115AAR metadata file: /Users/vmodi/.gradle/caches/transforms-3/4e8a32482e233cfbbc450e03aabed8dd/transformed/lifecycle-livedata-core-2.4.0/META-INF/com/android/build/gradle/aar-metadata.properties.
116

If i change my compileSdk 31 it gives me another error.

1plugins {
2    id 'com.android.application'
3    id 'kotlin-android'
4    id 'kotlin-kapt'
5}
6
7android {
8    compileSdk 30
9
10    configurations.all {
11        resolutionStrategy { force 'androidx.core:core-ktx:1.7.0-alpha01' }
12    }
13
14    defaultConfig {
15
16        applicationId "com.example.listadapter"
17        minSdk 21
18        targetSdk 30
19        versionCode 1
20        versionName "1.0"
21
22        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
23    }
24
25    buildTypes {
26        release {
27            minifyEnabled false
28            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
29        }
30    }
31    compileOptions {
32        sourceCompatibility JavaVersion.VERSION_1_8
33        targetCompatibility JavaVersion.VERSION_1_8
34    }
35    kotlinOptions {
36        jvmTarget = '1.8'
37    }
38
39    buildFeatures {
40        viewBinding true
41    }
42}
43
44dependencies {
45
46    implementation 'androidx.core:core-ktx:1.7.0'
47    implementation 'androidx.appcompat:appcompat:1.3.1'
48    implementation 'com.google.android.material:material:1.4.0'
49    implementation 'androidx.constraintlayout:constraintlayout:2.1.1'
50    testImplementation 'junit:junit:4.+'
51    androidTestImplementation 'androidx.test.ext:junit:1.1.3'
52    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
53
54    implementation "com.squareup.retrofit2:converter-moshi:2.5.0"
55    implementation 'com.squareup.okhttp3:logging-interceptor:4.9.1'
56    implementation 'com.squareup.retrofit2:retrofit:2.9.0'
57
58    implementation "com.squareup.moshi:moshi:1.12.0"
59    implementation "com.squareup.moshi:moshi-kotlin:1.12.0"
60
61    implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.0"
62    implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.4.0"
63    implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.4.0"
64    implementation "android.arch.lifecycle:extensions:1.1.1"
65    implementation 'androidx.fragment:fragment-ktx:1.3.6'
66}
67One or more issues found when checking AAR metadata values:
68
69The minCompileSdk (31) specified in a
70dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties)
71is greater than this module's compileSdkVersion (android-30).
72Dependency: androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.0.
73AAR metadata file: /Users/vmodi/.gradle/caches/transforms-3/b7f9608e476cb2e496993f185af8912c/transformed/jetified-lifecycle-viewmodel-ktx-2.4.0/META-INF/com/android/build/gradle/aar-metadata.properties.
74
75The minCompileSdk (31) specified in a
76dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties)
77is greater than this module's compileSdkVersion (android-30).
78Dependency: androidx.lifecycle:lifecycle-runtime-ktx:2.4.0.
79AAR metadata file: /Users/vmodi/.gradle/caches/transforms-3/538fea46e89a6c8a3e3eec533224abb8/transformed/jetified-lifecycle-runtime-ktx-2.4.0/META-INF/com/android/build/gradle/aar-metadata.properties.
80
81The minCompileSdk (31) specified in a
82dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties)
83is greater than this module's compileSdkVersion (android-30).
84Dependency: androidx.lifecycle:lifecycle-livedata-ktx:2.4.0.
85AAR metadata file: /Users/vmodi/.gradle/caches/transforms-3/6a1f77e99280b09902894e4ae8301047/transformed/jetified-lifecycle-livedata-ktx-2.4.0/META-INF/com/android/build/gradle/aar-metadata.properties.
86
87The minCompileSdk (31) specified in a
88dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties)
89is greater than this module's compileSdkVersion (android-30).
90Dependency: androidx.lifecycle:lifecycle-viewmodel:2.4.0.
91AAR metadata file: /Users/vmodi/.gradle/caches/transforms-3/41cf6125c3fd7a33d28222cf07d20520/transformed/lifecycle-viewmodel-2.4.0/META-INF/com/android/build/gradle/aar-metadata.properties.
92
93The minCompileSdk (31) specified in a
94dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties)
95is greater than this module's compileSdkVersion (android-30).
96Dependency: androidx.lifecycle:lifecycle-runtime:2.4.0.
97AAR metadata file: /Users/vmodi/.gradle/caches/transforms-3/655163560a267a5b16e2f66044d78641/transformed/lifecycle-runtime-2.4.0/META-INF/com/android/build/gradle/aar-metadata.properties.
98
99The minCompileSdk (31) specified in a
100dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties)
101is greater than this module's compileSdkVersion (android-30).
102Dependency: androidx.lifecycle:lifecycle-livedata:2.4.0.
103AAR metadata file: /Users/vmodi/.gradle/caches/transforms-3/1ca84d966e72f2f06b580da1765a55a5/transformed/lifecycle-livedata-2.4.0/META-INF/com/android/build/gradle/aar-metadata.properties.
104
105The minCompileSdk (31) specified in a
106dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties)
107is greater than this module's compileSdkVersion (android-30).
108Dependency: androidx.lifecycle:lifecycle-livedata-core-ktx:2.4.0.
109AAR metadata file: /Users/vmodi/.gradle/caches/transforms-3/3ed4d52253be7f6d85cbabee72c886d3/transformed/jetified-lifecycle-livedata-core-ktx-2.4.0/META-INF/com/android/build/gradle/aar-metadata.properties.
110
111The minCompileSdk (31) specified in a
112dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties)
113is greater than this module's compileSdkVersion (android-30).
114Dependency: androidx.lifecycle:lifecycle-livedata-core:2.4.0.
115AAR metadata file: /Users/vmodi/.gradle/caches/transforms-3/4e8a32482e233cfbbc450e03aabed8dd/transformed/lifecycle-livedata-core-2.4.0/META-INF/com/android/build/gradle/aar-metadata.properties.
116Could not resolve all files for configuration ':app:androidApis'.
117Failed to transform android.jar to match attributes {artifactType=android-mockable-jar, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime, returnDefaultValues=false}.
118Execution failed for MockableJarTransform: /Users/vmodi/Library/Android/sdk/platforms/android-31/android.jar.
119Cannot create mockable android.jar
120/Users/vmodi/Library/Android/sdk/platforms/android-31/android.jar
121

ANSWER

Answered 2021-Nov-19 at 06:20

Dependency: androidx.lifecycle:lifecycle-runtime-ktx:2.4.0. The issue is with this dependency, there may be some transitive dependency error. I would suggest use the alpha version of this dependency, worked for me. Replace with this dependency : androidx.lifecycle:lifecycle-*:2.4.0-alpha03

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

QUESTION

Android Build Error: "lStar not found..."

Asked 2022-Feb-18 at 06:59

I have error like this after trying to build my apps in Emulator

/Users/joel/.gradle/caches/transforms-3/06231cc1265260b25a06bafce7a4176f/transformed/core-1.7.0-alpha02/res/values/values.xml:105:5-114:25: AAPT: error: resource android:attr/lStar not found.

I don't know what causes this error. After digging some answer which has similarly error (but in flutter) Problem. But still not solved my issue.

I have this dependency in my project

1buildscript {
2    repositories {
3        google()
4        maven { url 'https://plugins.gradle.org/m2/' }
5    }
6
7    dependencies {
8        classpath 'com.google.gms:google-services:4.3.3'
9        classpath 'com.google.firebase:firebase-crashlytics-gradle:2.3.0'
10    }
11}
12apply plugin: 'com.android.application'
13apply plugin: 'com.google.gms.google-services'
14apply plugin: 'kotlin-android'
15apply plugin: 'kotlin-android-extensions'
16apply plugin: 'kotlin-kapt'
17apply plugin: 'com.google.firebase.crashlytics'
18
19repositories {
20    maven { url 'https://maven.fabric.io/public' }
21    maven { url 'https://maven.google.com' }
22    maven { url  "https://teads.jfrog.io/artifactory/SDKAndroid-maven-prod"}
23    mavenCentral()
24
25}
26
27android {
28    compileSdkVersion 29
29    buildToolsVersion '28.0.3'
30    defaultConfig {
31        applicationId "mobile.apps.my"
32        minSdkVersion 17
33        targetSdkVersion 29
34        multiDexEnabled true
35        versionCode 152
36        versionName "8.1.7"
37        vectorDrawables.useSupportLibrary = true // This line hereP
38        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
39    }
40
41    compileOptions {
42        sourceCompatibility JavaVersion.VERSION_1_8
43        targetCompatibility JavaVersion.VERSION_1_8
44    }
45
46    dataBinding {
47        enabled = true
48    }
49
50    buildTypes {
51        debug {
52            firebaseCrashlytics {
53                mappingFileUploadEnabled false
54            }
55        }
56
57        release {
58            minifyEnabled true
59            shrinkResources true
60            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
61        }
62    }
63
64    lintOptions {
65        checkReleaseBuilds false
66        abortOnError false
67    }
68}
69
70dependencies {
71
72    implementation fileTree(include: ['*.jar'], dir: 'libs')
73    androidTestImplementation('androidx.test.espresso:espresso-core:3.2.0-beta01', {
74        exclude group: 'com.android.support', module: 'support-annotations'
75    })
76    //noinspection GradleCompatible
77    implementation 'androidx.appcompat:appcompat:1.4.0-alpha03'
78    implementation "androidx.appcompat:appcompat-resources:1.4.0-alpha03"
79
80    implementation 'androidx.constraintlayout:constraintlayout:2.1.0'
81    implementation 'androidx.preference:preference:1.1.1'
82    implementation 'com.google.android.material:material:1.4.0'
83    implementation 'androidx.recyclerview:recyclerview:1.2.1'
84    implementation 'androidx.cardview:cardview:1.0.0'
85    implementation 'androidx.percentlayout:percentlayout:1.0.0'
86
87    implementation 'com.google.android.gms:play-services-analytics:17.0.0'
88    implementation 'it.sephiroth.android.library.imagezoom:imagezoom:2.3.0'
89    testImplementation 'org.json:json:20140107'
90    implementation 'com.comscore:android-analytics:6.1.0'
91    implementation 'com.android.support:customtabs:29.0.0'
92    implementation 'androidx.viewpager2:viewpager2:1.0.0'
93    implementation 'com.android.support:customtabs:29.0.0'
94
95    // Kodein Dependency Injection
96    implementation 'org.kodein.di:kodein-di-generic-jvm:6.2.1'
97    implementation 'org.kodein.di:kodein-di-framework-android-x:6.2.1'
98
99    // RETROFIT
100    implementation 'com.squareup.retrofit2:retrofit:2.6.0'
101    implementation 'com.squareup.retrofit2:converter-gson:2.4.0'
102    implementation 'com.squareup.okhttp3:logging-interceptor:3.10.0'
103    implementation 'com.google.code.gson:gson:2.8.5'
104    implementation 'com.squareup.retrofit2:converter-scalars:2.1.0' // for test String
105
106
107    // Room components
108    implementation "androidx.room:room-runtime:2.2.5"
109    kapt "androidx.room:room-compiler:2.2.5"
110    implementation "androidx.room:room-ktx:2.2.5"
111    androidTestImplementation "androidx.room:room-testing:2.2.5"
112
113    // Lifecycle components
114    implementation 'android.arch.lifecycle:extensions:1.1.1'
115    implementation 'androidx.paging:paging-runtime:2.1.2'
116
117    // UI
118    implementation 'com.squareup.picasso:picasso:2.71828'
119    implementation 'com.geniusforapp.fancydialog:FancyDialog:0.1.4'
120    implementation 'com.github.bluzwong:swipeback:0.2.0@aar'
121    implementation 'com.airbnb.android:lottie:3.6.0'
122
123    implementation 'com.veinhorn.scrollgalleryview:library:1.2.6'
124    implementation 'com.veinhorn.scrollgalleryview:picasso-loader:1.2.4'
125    implementation 'com.github.rubensousa:bottomsheetbuilder:1.6.1'
126    implementation "com.andkulikov:transitionseverywhere:1.8.1"
127
128
129    // HTTP LOGGING
130    implementation 'com.jakewharton.timber:timber:4.7.1'
131    implementation 'org.jsoup:jsoup:1.13.1'
132    implementation 'androidx.multidex:multidex:2.0.1'
133
134
135    // ADS
136    implementation 'com.android.support:support-annotations:28.0.0'
137    // Required Dependency by Audience Network SDK
138    implementation 'com.google.android.gms:play-services-ads:19.7.0'
139    implementation 'com.google.android.gms:play-services-basement:17.6.0'
140    implementation("tv.teads.sdk.android:sdk:4.7.2@aar") {
141        transitive = true
142    }
143    implementation 'com.criteo.publisher:criteo-publisher-sdk:4.0.0'
144    implementation 'com.google.android.gms:play-services-ads-identifier:17.0.0'
145    implementation 'com.google.android.gms:play-services-base:17.6.0'
146
147    implementation ('com.facebook.android:audience-network-sdk:5.5.0'){
148        exclude group: 'com.google.android.gms'
149    }
150
151    implementation 'com.google.firebase:firebase-crashlytics:17.4.0'
152
153    implementation "androidx.core:core-ktx:1.6.0"  // I have update this based on other solution
154    implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1"
155    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
156
157    // COROUTINES
158    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.1'
159    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.3'
160    implementation 'com.jakewharton.retrofit:retrofit2-kotlin-coroutines-adapter:0.9.2'
161
162    // Kotlin + coroutines
163    implementation "androidx.work:work-runtime-ktx:2.5.0"
164
165    implementation 'com.github.mumayank:AirLocation:1.3.1'
166    androidTestImplementation 'androidx.test:rules:1.3.0-beta01'
167
168    implementation 'com.android.installreferrer:installreferrer:2.2'
169
170    //ANIMATION
171    implementation 'com.daimajia.androidanimations:library:2.4@aar'
172    implementation 'com.infideap.drawerbehavior:drawer-behavior:1.0.4'
173    implementation 'com.romandanylyk:pageindicatorview:1.0.3'
174
175    implementation 'org.ocpsoft.prettytime:prettytime:5.0.0.Final'
176
177    //SOCIAL
178    implementation 'com.google.android.gms:play-services-auth:19.0.0'
179
180}
181

I have tried to upgrade version of androidx.core:core-ktx:1.6.0 then sync or invalidate cache/restart. But none of them give me good result. I am sure yesterday my project was alright with same dependency. Someone please help me, if this question unclear let me add more information. Thanks

ANSWER

Answered 2021-Sep-28 at 17:18

I managed to fix this by upgrading compileSdk to 31 and kotlin gradle plugin to 1.5.10

1buildscript {
2    repositories {
3        google()
4        maven { url 'https://plugins.gradle.org/m2/' }
5    }
6
7    dependencies {
8        classpath 'com.google.gms:google-services:4.3.3'
9        classpath 'com.google.firebase:firebase-crashlytics-gradle:2.3.0'
10    }
11}
12apply plugin: 'com.android.application'
13apply plugin: 'com.google.gms.google-services'
14apply plugin: 'kotlin-android'
15apply plugin: 'kotlin-android-extensions'
16apply plugin: 'kotlin-kapt'
17apply plugin: 'com.google.firebase.crashlytics'
18
19repositories {
20    maven { url 'https://maven.fabric.io/public' }
21    maven { url 'https://maven.google.com' }
22    maven { url  "https://teads.jfrog.io/artifactory/SDKAndroid-maven-prod"}
23    mavenCentral()
24
25}
26
27android {
28    compileSdkVersion 29
29    buildToolsVersion '28.0.3'
30    defaultConfig {
31        applicationId "mobile.apps.my"
32        minSdkVersion 17
33        targetSdkVersion 29
34        multiDexEnabled true
35        versionCode 152
36        versionName "8.1.7"
37        vectorDrawables.useSupportLibrary = true // This line hereP
38        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
39    }
40
41    compileOptions {
42        sourceCompatibility JavaVersion.VERSION_1_8
43        targetCompatibility JavaVersion.VERSION_1_8
44    }
45
46    dataBinding {
47        enabled = true
48    }
49
50    buildTypes {
51        debug {
52            firebaseCrashlytics {
53                mappingFileUploadEnabled false
54            }
55        }
56
57        release {
58            minifyEnabled true
59            shrinkResources true
60            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
61        }
62    }
63
64    lintOptions {
65        checkReleaseBuilds false
66        abortOnError false
67    }
68}
69
70dependencies {
71
72    implementation fileTree(include: ['*.jar'], dir: 'libs')
73    androidTestImplementation('androidx.test.espresso:espresso-core:3.2.0-beta01', {
74        exclude group: 'com.android.support', module: 'support-annotations'
75    })
76    //noinspection GradleCompatible
77    implementation 'androidx.appcompat:appcompat:1.4.0-alpha03'
78    implementation "androidx.appcompat:appcompat-resources:1.4.0-alpha03"
79
80    implementation 'androidx.constraintlayout:constraintlayout:2.1.0'
81    implementation 'androidx.preference:preference:1.1.1'
82    implementation 'com.google.android.material:material:1.4.0'
83    implementation 'androidx.recyclerview:recyclerview:1.2.1'
84    implementation 'androidx.cardview:cardview:1.0.0'
85    implementation 'androidx.percentlayout:percentlayout:1.0.0'
86
87    implementation 'com.google.android.gms:play-services-analytics:17.0.0'
88    implementation 'it.sephiroth.android.library.imagezoom:imagezoom:2.3.0'
89    testImplementation 'org.json:json:20140107'
90    implementation 'com.comscore:android-analytics:6.1.0'
91    implementation 'com.android.support:customtabs:29.0.0'
92    implementation 'androidx.viewpager2:viewpager2:1.0.0'
93    implementation 'com.android.support:customtabs:29.0.0'
94
95    // Kodein Dependency Injection
96    implementation 'org.kodein.di:kodein-di-generic-jvm:6.2.1'
97    implementation 'org.kodein.di:kodein-di-framework-android-x:6.2.1'
98
99    // RETROFIT
100    implementation 'com.squareup.retrofit2:retrofit:2.6.0'
101    implementation 'com.squareup.retrofit2:converter-gson:2.4.0'
102    implementation 'com.squareup.okhttp3:logging-interceptor:3.10.0'
103    implementation 'com.google.code.gson:gson:2.8.5'
104    implementation 'com.squareup.retrofit2:converter-scalars:2.1.0' // for test String
105
106
107    // Room components
108    implementation "androidx.room:room-runtime:2.2.5"
109    kapt "androidx.room:room-compiler:2.2.5"
110    implementation "androidx.room:room-ktx:2.2.5"
111    androidTestImplementation "androidx.room:room-testing:2.2.5"
112
113    // Lifecycle components
114    implementation 'android.arch.lifecycle:extensions:1.1.1'
115    implementation 'androidx.paging:paging-runtime:2.1.2'
116
117    // UI
118    implementation 'com.squareup.picasso:picasso:2.71828'
119    implementation 'com.geniusforapp.fancydialog:FancyDialog:0.1.4'
120    implementation 'com.github.bluzwong:swipeback:0.2.0@aar'
121    implementation 'com.airbnb.android:lottie:3.6.0'
122
123    implementation 'com.veinhorn.scrollgalleryview:library:1.2.6'
124    implementation 'com.veinhorn.scrollgalleryview:picasso-loader:1.2.4'
125    implementation 'com.github.rubensousa:bottomsheetbuilder:1.6.1'
126    implementation "com.andkulikov:transitionseverywhere:1.8.1"
127
128
129    // HTTP LOGGING
130    implementation 'com.jakewharton.timber:timber:4.7.1'
131    implementation 'org.jsoup:jsoup:1.13.1'
132    implementation 'androidx.multidex:multidex:2.0.1'
133
134
135    // ADS
136    implementation 'com.android.support:support-annotations:28.0.0'
137    // Required Dependency by Audience Network SDK
138    implementation 'com.google.android.gms:play-services-ads:19.7.0'
139    implementation 'com.google.android.gms:play-services-basement:17.6.0'
140    implementation("tv.teads.sdk.android:sdk:4.7.2@aar") {
141        transitive = true
142    }
143    implementation 'com.criteo.publisher:criteo-publisher-sdk:4.0.0'
144    implementation 'com.google.android.gms:play-services-ads-identifier:17.0.0'
145    implementation 'com.google.android.gms:play-services-base:17.6.0'
146
147    implementation ('com.facebook.android:audience-network-sdk:5.5.0'){
148        exclude group: 'com.google.android.gms'
149    }
150
151    implementation 'com.google.firebase:firebase-crashlytics:17.4.0'
152
153    implementation "androidx.core:core-ktx:1.6.0"  // I have update this based on other solution
154    implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1"
155    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
156
157    // COROUTINES
158    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.1'
159    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.3'
160    implementation 'com.jakewharton.retrofit:retrofit2-kotlin-coroutines-adapter:0.9.2'
161
162    // Kotlin + coroutines
163    implementation "androidx.work:work-runtime-ktx:2.5.0"
164
165    implementation 'com.github.mumayank:AirLocation:1.3.1'
166    androidTestImplementation 'androidx.test:rules:1.3.0-beta01'
167
168    implementation 'com.android.installreferrer:installreferrer:2.2'
169
170    //ANIMATION
171    implementation 'com.daimajia.androidanimations:library:2.4@aar'
172    implementation 'com.infideap.drawerbehavior:drawer-behavior:1.0.4'
173    implementation 'com.romandanylyk:pageindicatorview:1.0.3'
174
175    implementation 'org.ocpsoft.prettytime:prettytime:5.0.0.Final'
176
177    //SOCIAL
178    implementation 'com.google.android.gms:play-services-auth:19.0.0'
179
180}
181compileSdk = 31
182
183classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.10'
184

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

QUESTION

Could not resolve com.google.guava:guava:30.1-jre - Gradle project sync failed. Basic functionality will not work properly - in kotlin project

Asked 2022-Feb-14 at 19:47

It was a project that used to work well in the past, but after updating, the following errors appear.

1plugins {
2    id 'com.android.application'
3    id 'kotlin-android'
4}
5
6android {
7    compileSdkVersion 30
8    buildToolsVersion "30.0.3"
9
10    defaultConfig {
11        applicationId "com.example.retrofit_test"
12        minSdkVersion 21
13        targetSdkVersion 30
14        versionCode 1
15        versionName "1.0"
16
17        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
18    }
19
20    buildTypes {
21        release {
22            minifyEnabled false
23            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
24        }
25    }
26    compileOptions {
27        sourceCompatibility JavaVersion.VERSION_1_8
28        targetCompatibility JavaVersion.VERSION_1_8
29    }
30    kotlinOptions {
31        jvmTarget = '1.8'
32    }
33}
34
35dependencies {
36
37//    implementation 'com.google.guava:guava:30.1.1-jre'
38    implementation 'com.google.guava:guava:30.1-jre'
39
40//    implementation 'org.jetbrains.kotlin:kotlin-stdlib:1.5.30-M1'
41
42    implementation 'androidx.core:core-ktx:1.6.0'
43    implementation 'androidx.appcompat:appcompat:1.3.1'
44    implementation 'com.google.android.material:material:1.4.0'
45    implementation 'androidx.constraintlayout:constraintlayout:2.1.0'
46    implementation 'androidx.navigation:navigation-fragment-ktx:2.3.5'
47    implementation 'androidx.navigation:navigation-ui-ktx:2.3.5'
48    implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.3.1'
49    implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1'
50    implementation 'androidx.navigation:navigation-fragment-ktx:2.3.5'
51    implementation 'androidx.navigation:navigation-ui-ktx:2.3.5'
52
53    implementation 'com.squareup.retrofit2:retrofit:2.9.0'
54    implementation 'com.google.code.gson:gson:2.8.7'
55    implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
56    implementation 'com.squareup.okhttp3:logging-interceptor:4.9.1'
57
58    implementation 'com.github.bumptech.glide:glide:4.12.0'
59    implementation 'android.arch.persistence.room:guava:1.1.1'
60    annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0'
61
62    testImplementation 'junit:junit:4.13.2'
63    androidTestImplementation 'androidx.test.ext:junit:1.1.3'
64    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
65}
66

If we need more source code to check, I will update it.

The error contents are as follows.

A problem occurred configuring root project 'Retrofit_Test'.

1plugins {
2    id 'com.android.application'
3    id 'kotlin-android'
4}
5
6android {
7    compileSdkVersion 30
8    buildToolsVersion "30.0.3"
9
10    defaultConfig {
11        applicationId "com.example.retrofit_test"
12        minSdkVersion 21
13        targetSdkVersion 30
14        versionCode 1
15        versionName "1.0"
16
17        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
18    }
19
20    buildTypes {
21        release {
22            minifyEnabled false
23            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
24        }
25    }
26    compileOptions {
27        sourceCompatibility JavaVersion.VERSION_1_8
28        targetCompatibility JavaVersion.VERSION_1_8
29    }
30    kotlinOptions {
31        jvmTarget = '1.8'
32    }
33}
34
35dependencies {
36
37//    implementation 'com.google.guava:guava:30.1.1-jre'
38    implementation 'com.google.guava:guava:30.1-jre'
39
40//    implementation 'org.jetbrains.kotlin:kotlin-stdlib:1.5.30-M1'
41
42    implementation 'androidx.core:core-ktx:1.6.0'
43    implementation 'androidx.appcompat:appcompat:1.3.1'
44    implementation 'com.google.android.material:material:1.4.0'
45    implementation 'androidx.constraintlayout:constraintlayout:2.1.0'
46    implementation 'androidx.navigation:navigation-fragment-ktx:2.3.5'
47    implementation 'androidx.navigation:navigation-ui-ktx:2.3.5'
48    implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.3.1'
49    implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1'
50    implementation 'androidx.navigation:navigation-fragment-ktx:2.3.5'
51    implementation 'androidx.navigation:navigation-ui-ktx:2.3.5'
52
53    implementation 'com.squareup.retrofit2:retrofit:2.9.0'
54    implementation 'com.google.code.gson:gson:2.8.7'
55    implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
56    implementation 'com.squareup.okhttp3:logging-interceptor:4.9.1'
57
58    implementation 'com.github.bumptech.glide:glide:4.12.0'
59    implementation 'android.arch.persistence.room:guava:1.1.1'
60    annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0'
61
62    testImplementation 'junit:junit:4.13.2'
63    androidTestImplementation 'androidx.test.ext:junit:1.1.3'
64    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
65}
66   Could not resolve all artifacts for configuration ':classpath'.
67   Could not find org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.30.
68     Searched in the following locations:
69       - https://dl.google.com/dl/android/maven2/org/jetbrains/kotlin/kotlin-gradle-plugin/1.5.30/kotlin-gradle-plugin-1.5.30.pom
70     If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
71     Required by:
72         project :
73   Could not find org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.4.32.
74     Searched in the following locations:
75       - https://dl.google.com/dl/android/maven2/org/jetbrains/kotlin/kotlin-stdlib-jdk8/1.4.32/kotlin-stdlib-jdk8-1.4.32.pom
76     If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
77     Required by:
78         project : > com.android.tools.build:gradle:7.0.2
79         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools:sdk-common:30.0.2
80         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools:repository:30.0.2
81         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:aaptcompiler:7.0.2
82         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.analytics-library:shared:30.0.2
83         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.lint:lint-model:30.0.2
84         project : > com.android.tools.build:gradle:7.0.2 > androidx.databinding:databinding-compiler-common:7.0.2
85         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.utp:android-test-plugin-host-retention-proto:30.0.2
86         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:builder:7.0.2
87         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:builder-model:7.0.2
88         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:gradle-api:7.0.2
89         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools:sdk-common:30.0.2 > com.android.tools:common:30.0.2
90         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:builder:7.0.2 > com.android.tools.analytics-library:tracker:30.0.2
91         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:builder:7.0.2 > com.android.tools.build:manifest-merger:30.0.2
92   Could not find org.apache.httpcomponents:httpmime:4.5.6.
93     Searched in the following locations:
94       - https://dl.google.com/dl/android/maven2/org/apache/httpcomponents/httpmime/4.5.6/httpmime-4.5.6.pom
95     If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
96     Required by:
97         project : > com.android.tools.build:gradle:7.0.2
98         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools:sdklib:30.0.2
99         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.analytics-library:crash:30.0.2
100   Could not find commons-io:commons-io:2.4.
101     Searched in the following locations:
102       - https://dl.google.com/dl/android/maven2/commons-io/commons-io/2.4/commons-io-2.4.pom
103     If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
104     Required by:
105         project : > com.android.tools.build:gradle:7.0.2
106         project : > com.android.tools.build:gradle:7.0.2 > androidx.databinding:databinding-compiler-common:7.0.2
107   Could not find org.ow2.asm:asm:7.0.
108     Searched in the following locations:
109       - https://dl.google.com/dl/android/maven2/org/ow2/asm/asm/7.0/asm-7.0.pom
110     If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
111     Required by:
112         project : > com.android.tools.build:gradle:7.0.2
113         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:builder:7.0.2
114         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:gradle-api:7.0.2
115   Could not find org.ow2.asm:asm-analysis:7.0.
116     Searched in the following locations:
117       - https://dl.google.com/dl/android/maven2/org/ow2/asm/asm-analysis/7.0/asm-analysis-7.0.pom
118     If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
119     Required by:
120         project : > com.android.tools.build:gradle:7.0.2
121   Could not find org.ow2.asm:asm-commons:7.0.
122     Searched in the following locations:
123       - https://dl.google.com/dl/android/maven2/org/ow2/asm/asm-commons/7.0/asm-commons-7.0.pom
124     If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
125     Required by:
126         project : > com.android.tools.build:gradle:7.0.2
127         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:builder:7.0.2
128   Could not find org.ow2.asm:asm-util:7.0.
129     Searched in the following locations:
130       - https://dl.google.com/dl/android/maven2/org/ow2/asm/asm-util/7.0/asm-util-7.0.pom
131     If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
132     Required by:
133         project : > com.android.tools.build:gradle:7.0.2
134         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:builder:7.0.2
135   Could not find org.bouncycastle:bcpkix-jdk15on:1.56.
136     Searched in the following locations:
137       - https://dl.google.com/dl/android/maven2/org/bouncycastle/bcpkix-jdk15on/1.56/bcpkix-jdk15on-1.56.pom
138     If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
139     Required by:
140         project : > com.android.tools.build:gradle:7.0.2
141         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools:sdk-common:30.0.2
142         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:builder:7.0.2
143         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:builder:7.0.2 > com.android.tools.build:apkzlib:7.0.2
144   Could not find org.glassfish.jaxb:jaxb-runtime:2.3.2.
145     Searched in the following locations:
146       - https://dl.google.com/dl/android/maven2/org/glassfish/jaxb/jaxb-runtime/2.3.2/jaxb-runtime-2.3.2.pom
147     If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
148     Required by:
149         project : > com.android.tools.build:gradle:7.0.2
150         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools:sdk-common:30.0.2
151         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools:sdklib:30.0.2
152         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools:repository:30.0.2
153         project : > com.android.tools.build:gradle:7.0.2 > androidx.databinding:databinding-compiler-common:7.0.2
154   Could not find net.sf.jopt-simple:jopt-simple:4.9.
155     Searched in the following locations:
156       - https://dl.google.com/dl/android/maven2/net/sf/jopt-simple/jopt-simple/4.9/jopt-simple-4.9.pom
157     If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
158     Required by:
159         project : > com.android.tools.build:gradle:7.0.2
160         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:builder:7.0.2
161   Could not find com.squareup:javapoet:1.10.0.
162     Searched in the following locations:
163       - https://dl.google.com/dl/android/maven2/com/squareup/javapoet/1.10.0/javapoet-1.10.0.pom
164     If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
165     Required by:
166         project : > com.android.tools.build:gradle:7.0.2
167         project : > com.android.tools.build:gradle:7.0.2 > androidx.databinding:databinding-compiler-common:7.0.2
168   Could not find com.google.protobuf:protobuf-java:3.10.0.
169     Searched in the following locations:
170       - https://dl.google.com/dl/android/maven2/com/google/protobuf/protobuf-java/3.10.0/protobuf-java-3.10.0.pom
171     If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
172     Required by:
173         project : > com.android.tools.build:gradle:7.0.2
174         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools:sdk-common:30.0.2
175         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.ddms:ddmlib:30.0.2
176         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:aapt2-proto:7.0.2-7396180
177         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:aaptcompiler:7.0.2
178         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.utp:android-device-provider-gradle-proto:30.0.2
179         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.utp:android-test-plugin-host-retention-proto:30.0.2
180         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.utp:android-test-plugin-result-listener-gradle-proto:30.0.2
181         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:bundletool:1.6.0
182         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.analytics-library:shared:30.0.2 > com.android.tools.analytics-library:protos:30.0.2
183         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:builder:7.0.2 > com.android.tools.analytics-library:tracker:30.0.2
184   Could not find com.google.protobuf:protobuf-java-util:3.10.0.
185     Searched in the following locations:
186       - https://dl.google.com/dl/android/maven2/com/google/protobuf/protobuf-java-util/3.10.0/protobuf-java-util-3.10.0.pom
187     If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
188     Required by:
189         project : > com.android.tools.build:gradle:7.0.2
190         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:bundletool:1.6.0
191   Could not find com.google.code.gson:gson:2.8.6.
192     Searched in the following locations:
193       - https://dl.google.com/dl/android/maven2/com/google/code/gson/gson/2.8.6/gson-2.8.6.pom
194     If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
195     Required by:
196         project : > com.android.tools.build:gradle:7.0.2
197         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools:sdk-common:30.0.2
198         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools:sdklib:30.0.2
199         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.analytics-library:shared:30.0.2
200         project : > com.android.tools.build:gradle:7.0.2 > androidx.databinding:databinding-compiler-common:7.0.2
201         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.utp:android-test-plugin-result-listener-gradle-proto:30.0.2
202         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:builder:7.0.2 > com.android.tools.build:manifest-merger:30.0.2
203   Could not find io.grpc:grpc-core:1.21.1.
204     Searched in the following locations:
205       - https://dl.google.com/dl/android/maven2/io/grpc/grpc-core/1.21.1/grpc-core-1.21.1.pom
206     If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
207     Required by:
208         project : > com.android.tools.build:gradle:7.0.2
209         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.utp:android-test-plugin-result-listener-gradle-proto:30.0.2
210   Could not find io.grpc:grpc-netty:1.21.1.
211     Searched in the following locations:
212       - https://dl.google.com/dl/android/maven2/io/grpc/grpc-netty/1.21.1/grpc-netty-1.21.1.pom
213     If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
214     Required by:
215         project : > com.android.tools.build:gradle:7.0.2
216         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.utp:android-test-plugin-result-listener-gradle-proto:30.0.2
217   Could not find io.grpc:grpc-protobuf:1.21.1.
218     Searched in the following locations:
219       - https://dl.google.com/dl/android/maven2/io/grpc/grpc-protobuf/1.21.1/grpc-protobuf-1.21.1.pom
220     If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
221     Required by:
222         project : > com.android.tools.build:gradle:7.0.2
223         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.utp:android-test-plugin-result-listener-gradle-proto:30.0.2
224   Could not find io.grpc:grpc-stub:1.21.1.
225     Searched in the following locations:
226       - https://dl.google.com/dl/android/maven2/io/grpc/grpc-stub/1.21.1/grpc-stub-1.21.1.pom
227     If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
228     Required by:
229         project : > com.android.tools.build:gradle:7.0.2
230         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.utp:android-test-plugin-result-listener-gradle-proto:30.0.2
231   Could not find com.google.crypto.tink:tink:1.3.0-rc2.
232     Searched in the following locations:
233       - https://dl.google.com/dl/android/maven2/com/google/crypto/tink/tink/1.3.0-rc2/tink-1.3.0-rc2.pom
234     If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
235     Required by:
236         project : > com.android.tools.build:gradle:7.0.2
237   Could not find com.google.flatbuffers:flatbuffers-java:1.12.0.
238     Searched in the following locations:
239       - https://dl.google.com/dl/android/maven2/com/google/flatbuffers/flatbuffers-java/1.12.0/flatbuffers-java-1.12.0.pom
240     If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
241     Required by:
242         project : > com.android.tools.build:gradle:7.0.2
243   Could not find org.tensorflow:tensorflow-lite-metadata:0.1.0-rc2.
244     Searched in the following locations:
245       - https://dl.google.com/dl/android/maven2/org/tensorflow/tensorflow-lite-metadata/0.1.0-rc2/tensorflow-lite-metadata-0.1.0-rc2.pom
246     If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
247     Required by:
248         project : > com.android.tools.build:gradle:7.0.2
249   Could not find org.bouncycastle:bcprov-jdk15on:1.56.
250     Searched in the following locations:
251       - https://dl.google.com/dl/android/maven2/org/bouncycastle/bcprov-jdk15on/1.56/bcprov-jdk15on-1.56.pom
252     If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
253     Required by:
254         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools:sdk-common:30.0.2
255         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:builder:7.0.2
256         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:builder:7.0.2 > com.android.tools.build:apkzlib:7.0.2
257   Could not find com.google.guava:guava:30.1-jre.
258     Searched in the following locations:
259       - https://dl.google.com/dl/android/maven2/com/google/guava/guava/30.1-jre/guava-30.1-jre.pom
260     If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
261     Required by:
262         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools:sdk-common:30.0.2
263         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:aaptcompiler:7.0.2
264         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.analytics-library:crash:30.0.2
265         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.analytics-library:shared:30.0.2
266         project : > com.android.tools.build:gradle:7.0.2 > androidx.databinding:databinding-compiler-common:7.0.2
267         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:builder-test-api:7.0.2
268         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.utp:android-test-plugin-result-listener-gradle-proto:30.0.2
269         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:bundletool:1.6.0
270         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:gradle-api:7.0.2
271         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools:sdk-common:30.0.2 > com.android.tools:common:30.0.2
272         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:builder:7.0.2 > com.android.tools.analytics-library:tracker:30.0.2
273   Could not find org.jetbrains.kotlin:kotlin-reflect:1.4.32.
274     Searched in the following locations:
275       - https://dl.google.com/dl/android/maven2/org/jetbrains/kotlin/kotlin-reflect/1.4.32/kotlin-reflect-1.4.32.pom
276     If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
277     Required by:
278         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools:sdk-common:30.0.2
279   Could not find javax.inject:javax.inject:1.
280     Searched in the following locations:
281       - https://dl.google.com/dl/android/maven2/javax/inject/javax.inject/1/javax.inject-1.pom
282     If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
283     Required by:
284         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools:sdk-common:30.0.2
285         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:bundletool:1.6.0
286         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:builder:7.0.2
287   Could not find net.sf.kxml:kxml2:2.3.0.
288     Searched in the following locations:
289       - https://dl.google.com/dl/android/maven2/net/sf/kxml/kxml2/2.3.0/kxml2-2.3.0.pom
290     If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
291     Required by:
292         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools:sdk-common:30.0.2
293         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.ddms:ddmlib:30.0.2
294         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.lint:lint-model:30.0.2
295         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.layoutlib:layoutlib-api:30.0.2
296         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:builder:7.0.2 > com.android.tools.build:manifest-merger:30.0.2
297   Could not find org.jetbrains.intellij.deps:trove4j:1.0.20181211.
298     Searched in the following locations:
299       - https://dl.google.com/dl/android/maven2/org/jetbrains/intellij/deps/trove4j/1.0.20181211/trove4j-1.0.20181211.pom
300     If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
301     Required by:
302         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools:sdk-common:30.0.2
303   Could not find xerces:xercesImpl:2.12.0.
304     Searched in the following locations:
305       - https://dl.google.com/dl/android/maven2/xerces/xercesImpl/2.12.0/xercesImpl-2.12.0.pom
306     If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
307     Required by:
308         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools:sdk-common:30.0.2
309   Could not find org.apache.commons:commons-compress:1.20.
310     Searched in the following locations:
311       - https://dl.google.com/dl/android/maven2/org/apache/commons/commons-compress/1.20/commons-compress-1.20.pom
312     If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
313

ANSWER

Answered 2021-Sep-17 at 11:03

Add mavenCentral() in Build Script

1plugins {
2    id 'com.android.application'
3    id 'kotlin-android'
4}
5
6android {
7    compileSdkVersion 30
8    buildToolsVersion "30.0.3"
9
10    defaultConfig {
11        applicationId "com.example.retrofit_test"
12        minSdkVersion 21
13        targetSdkVersion 30
14        versionCode 1
15        versionName "1.0"
16
17        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
18    }
19
20    buildTypes {
21        release {
22            minifyEnabled false
23            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
24        }
25    }
26    compileOptions {
27        sourceCompatibility JavaVersion.VERSION_1_8
28        targetCompatibility JavaVersion.VERSION_1_8
29    }
30    kotlinOptions {
31        jvmTarget = '1.8'
32    }
33}
34
35dependencies {
36
37//    implementation 'com.google.guava:guava:30.1.1-jre'
38    implementation 'com.google.guava:guava:30.1-jre'
39
40//    implementation 'org.jetbrains.kotlin:kotlin-stdlib:1.5.30-M1'
41
42    implementation 'androidx.core:core-ktx:1.6.0'
43    implementation 'androidx.appcompat:appcompat:1.3.1'
44    implementation 'com.google.android.material:material:1.4.0'
45    implementation 'androidx.constraintlayout:constraintlayout:2.1.0'
46    implementation 'androidx.navigation:navigation-fragment-ktx:2.3.5'
47    implementation 'androidx.navigation:navigation-ui-ktx:2.3.5'
48    implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.3.1'
49    implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1'
50    implementation 'androidx.navigation:navigation-fragment-ktx:2.3.5'
51    implementation 'androidx.navigation:navigation-ui-ktx:2.3.5'
52
53    implementation 'com.squareup.retrofit2:retrofit:2.9.0'
54    implementation 'com.google.code.gson:gson:2.8.7'
55    implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
56    implementation 'com.squareup.okhttp3:logging-interceptor:4.9.1'
57
58    implementation 'com.github.bumptech.glide:glide:4.12.0'
59    implementation 'android.arch.persistence.room:guava:1.1.1'
60    annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0'
61
62    testImplementation 'junit:junit:4.13.2'
63    androidTestImplementation 'androidx.test.ext:junit:1.1.3'
64    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
65}
66   Could not resolve all artifacts for configuration ':classpath'.
67   Could not find org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.30.
68     Searched in the following locations:
69       - https://dl.google.com/dl/android/maven2/org/jetbrains/kotlin/kotlin-gradle-plugin/1.5.30/kotlin-gradle-plugin-1.5.30.pom
70     If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
71     Required by:
72         project :
73   Could not find org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.4.32.
74     Searched in the following locations:
75       - https://dl.google.com/dl/android/maven2/org/jetbrains/kotlin/kotlin-stdlib-jdk8/1.4.32/kotlin-stdlib-jdk8-1.4.32.pom
76     If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
77     Required by:
78         project : > com.android.tools.build:gradle:7.0.2
79         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools:sdk-common:30.0.2
80         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools:repository:30.0.2
81         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:aaptcompiler:7.0.2
82         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.analytics-library:shared:30.0.2
83         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.lint:lint-model:30.0.2
84         project : > com.android.tools.build:gradle:7.0.2 > androidx.databinding:databinding-compiler-common:7.0.2
85         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.utp:android-test-plugin-host-retention-proto:30.0.2
86         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:builder:7.0.2
87         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:builder-model:7.0.2
88         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:gradle-api:7.0.2
89         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools:sdk-common:30.0.2 > com.android.tools:common:30.0.2
90         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:builder:7.0.2 > com.android.tools.analytics-library:tracker:30.0.2
91         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:builder:7.0.2 > com.android.tools.build:manifest-merger:30.0.2
92   Could not find org.apache.httpcomponents:httpmime:4.5.6.
93     Searched in the following locations:
94       - https://dl.google.com/dl/android/maven2/org/apache/httpcomponents/httpmime/4.5.6/httpmime-4.5.6.pom
95     If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
96     Required by:
97         project : > com.android.tools.build:gradle:7.0.2
98         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools:sdklib:30.0.2
99         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.analytics-library:crash:30.0.2
100   Could not find commons-io:commons-io:2.4.
101     Searched in the following locations:
102       - https://dl.google.com/dl/android/maven2/commons-io/commons-io/2.4/commons-io-2.4.pom
103     If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
104     Required by:
105         project : > com.android.tools.build:gradle:7.0.2
106         project : > com.android.tools.build:gradle:7.0.2 > androidx.databinding:databinding-compiler-common:7.0.2
107   Could not find org.ow2.asm:asm:7.0.
108     Searched in the following locations:
109       - https://dl.google.com/dl/android/maven2/org/ow2/asm/asm/7.0/asm-7.0.pom
110     If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
111     Required by:
112         project : > com.android.tools.build:gradle:7.0.2
113         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:builder:7.0.2
114         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:gradle-api:7.0.2
115   Could not find org.ow2.asm:asm-analysis:7.0.
116     Searched in the following locations:
117       - https://dl.google.com/dl/android/maven2/org/ow2/asm/asm-analysis/7.0/asm-analysis-7.0.pom
118     If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
119     Required by:
120         project : > com.android.tools.build:gradle:7.0.2
121   Could not find org.ow2.asm:asm-commons:7.0.
122     Searched in the following locations:
123       - https://dl.google.com/dl/android/maven2/org/ow2/asm/asm-commons/7.0/asm-commons-7.0.pom
124     If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
125     Required by:
126         project : > com.android.tools.build:gradle:7.0.2
127         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:builder:7.0.2
128   Could not find org.ow2.asm:asm-util:7.0.
129     Searched in the following locations:
130       - https://dl.google.com/dl/android/maven2/org/ow2/asm/asm-util/7.0/asm-util-7.0.pom
131     If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
132     Required by:
133         project : > com.android.tools.build:gradle:7.0.2
134         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:builder:7.0.2
135   Could not find org.bouncycastle:bcpkix-jdk15on:1.56.
136     Searched in the following locations:
137       - https://dl.google.com/dl/android/maven2/org/bouncycastle/bcpkix-jdk15on/1.56/bcpkix-jdk15on-1.56.pom
138     If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
139     Required by:
140         project : > com.android.tools.build:gradle:7.0.2
141         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools:sdk-common:30.0.2
142         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:builder:7.0.2
143         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:builder:7.0.2 > com.android.tools.build:apkzlib:7.0.2
144   Could not find org.glassfish.jaxb:jaxb-runtime:2.3.2.
145     Searched in the following locations:
146       - https://dl.google.com/dl/android/maven2/org/glassfish/jaxb/jaxb-runtime/2.3.2/jaxb-runtime-2.3.2.pom
147     If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
148     Required by:
149         project : > com.android.tools.build:gradle:7.0.2
150         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools:sdk-common:30.0.2
151         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools:sdklib:30.0.2
152         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools:repository:30.0.2
153         project : > com.android.tools.build:gradle:7.0.2 > androidx.databinding:databinding-compiler-common:7.0.2
154   Could not find net.sf.jopt-simple:jopt-simple:4.9.
155     Searched in the following locations:
156       - https://dl.google.com/dl/android/maven2/net/sf/jopt-simple/jopt-simple/4.9/jopt-simple-4.9.pom
157     If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
158     Required by:
159         project : > com.android.tools.build:gradle:7.0.2
160         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:builder:7.0.2
161   Could not find com.squareup:javapoet:1.10.0.
162     Searched in the following locations:
163       - https://dl.google.com/dl/android/maven2/com/squareup/javapoet/1.10.0/javapoet-1.10.0.pom
164     If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
165     Required by:
166         project : > com.android.tools.build:gradle:7.0.2
167         project : > com.android.tools.build:gradle:7.0.2 > androidx.databinding:databinding-compiler-common:7.0.2
168   Could not find com.google.protobuf:protobuf-java:3.10.0.
169     Searched in the following locations:
170       - https://dl.google.com/dl/android/maven2/com/google/protobuf/protobuf-java/3.10.0/protobuf-java-3.10.0.pom
171     If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
172     Required by:
173         project : > com.android.tools.build:gradle:7.0.2
174         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools:sdk-common:30.0.2
175         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.ddms:ddmlib:30.0.2
176         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:aapt2-proto:7.0.2-7396180
177         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:aaptcompiler:7.0.2
178         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.utp:android-device-provider-gradle-proto:30.0.2
179         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.utp:android-test-plugin-host-retention-proto:30.0.2
180         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.utp:android-test-plugin-result-listener-gradle-proto:30.0.2
181         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:bundletool:1.6.0
182         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.analytics-library:shared:30.0.2 > com.android.tools.analytics-library:protos:30.0.2
183         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:builder:7.0.2 > com.android.tools.analytics-library:tracker:30.0.2
184   Could not find com.google.protobuf:protobuf-java-util:3.10.0.
185     Searched in the following locations:
186       - https://dl.google.com/dl/android/maven2/com/google/protobuf/protobuf-java-util/3.10.0/protobuf-java-util-3.10.0.pom
187     If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
188     Required by:
189         project : > com.android.tools.build:gradle:7.0.2
190         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:bundletool:1.6.0
191   Could not find com.google.code.gson:gson:2.8.6.
192     Searched in the following locations:
193       - https://dl.google.com/dl/android/maven2/com/google/code/gson/gson/2.8.6/gson-2.8.6.pom
194     If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
195     Required by:
196         project : > com.android.tools.build:gradle:7.0.2
197         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools:sdk-common:30.0.2
198         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools:sdklib:30.0.2
199         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.analytics-library:shared:30.0.2
200         project : > com.android.tools.build:gradle:7.0.2 > androidx.databinding:databinding-compiler-common:7.0.2
201         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.utp:android-test-plugin-result-listener-gradle-proto:30.0.2
202         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:builder:7.0.2 > com.android.tools.build:manifest-merger:30.0.2
203   Could not find io.grpc:grpc-core:1.21.1.
204     Searched in the following locations:
205       - https://dl.google.com/dl/android/maven2/io/grpc/grpc-core/1.21.1/grpc-core-1.21.1.pom
206     If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
207     Required by:
208         project : > com.android.tools.build:gradle:7.0.2
209         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.utp:android-test-plugin-result-listener-gradle-proto:30.0.2
210   Could not find io.grpc:grpc-netty:1.21.1.
211     Searched in the following locations:
212       - https://dl.google.com/dl/android/maven2/io/grpc/grpc-netty/1.21.1/grpc-netty-1.21.1.pom
213     If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
214     Required by:
215         project : > com.android.tools.build:gradle:7.0.2
216         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.utp:android-test-plugin-result-listener-gradle-proto:30.0.2
217   Could not find io.grpc:grpc-protobuf:1.21.1.
218     Searched in the following locations:
219       - https://dl.google.com/dl/android/maven2/io/grpc/grpc-protobuf/1.21.1/grpc-protobuf-1.21.1.pom
220     If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
221     Required by:
222         project : > com.android.tools.build:gradle:7.0.2
223         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.utp:android-test-plugin-result-listener-gradle-proto:30.0.2
224   Could not find io.grpc:grpc-stub:1.21.1.
225     Searched in the following locations:
226       - https://dl.google.com/dl/android/maven2/io/grpc/grpc-stub/1.21.1/grpc-stub-1.21.1.pom
227     If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
228     Required by:
229         project : > com.android.tools.build:gradle:7.0.2
230         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.utp:android-test-plugin-result-listener-gradle-proto:30.0.2
231   Could not find com.google.crypto.tink:tink:1.3.0-rc2.
232     Searched in the following locations:
233       - https://dl.google.com/dl/android/maven2/com/google/crypto/tink/tink/1.3.0-rc2/tink-1.3.0-rc2.pom
234     If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
235     Required by:
236         project : > com.android.tools.build:gradle:7.0.2
237   Could not find com.google.flatbuffers:flatbuffers-java:1.12.0.
238     Searched in the following locations:
239       - https://dl.google.com/dl/android/maven2/com/google/flatbuffers/flatbuffers-java/1.12.0/flatbuffers-java-1.12.0.pom
240     If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
241     Required by:
242         project : > com.android.tools.build:gradle:7.0.2
243   Could not find org.tensorflow:tensorflow-lite-metadata:0.1.0-rc2.
244     Searched in the following locations:
245       - https://dl.google.com/dl/android/maven2/org/tensorflow/tensorflow-lite-metadata/0.1.0-rc2/tensorflow-lite-metadata-0.1.0-rc2.pom
246     If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
247     Required by:
248         project : > com.android.tools.build:gradle:7.0.2
249   Could not find org.bouncycastle:bcprov-jdk15on:1.56.
250     Searched in the following locations:
251       - https://dl.google.com/dl/android/maven2/org/bouncycastle/bcprov-jdk15on/1.56/bcprov-jdk15on-1.56.pom
252     If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
253     Required by:
254         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools:sdk-common:30.0.2
255         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:builder:7.0.2
256         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:builder:7.0.2 > com.android.tools.build:apkzlib:7.0.2
257   Could not find com.google.guava:guava:30.1-jre.
258     Searched in the following locations:
259       - https://dl.google.com/dl/android/maven2/com/google/guava/guava/30.1-jre/guava-30.1-jre.pom
260     If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
261     Required by:
262         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools:sdk-common:30.0.2
263         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:aaptcompiler:7.0.2
264         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.analytics-library:crash:30.0.2
265         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.analytics-library:shared:30.0.2
266         project : > com.android.tools.build:gradle:7.0.2 > androidx.databinding:databinding-compiler-common:7.0.2
267         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:builder-test-api:7.0.2
268         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.utp:android-test-plugin-result-listener-gradle-proto:30.0.2
269         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:bundletool:1.6.0
270         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:gradle-api:7.0.2
271         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools:sdk-common:30.0.2 > com.android.tools:common:30.0.2
272         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:builder:7.0.2 > com.android.tools.analytics-library:tracker:30.0.2
273   Could not find org.jetbrains.kotlin:kotlin-reflect:1.4.32.
274     Searched in the following locations:
275       - https://dl.google.com/dl/android/maven2/org/jetbrains/kotlin/kotlin-reflect/1.4.32/kotlin-reflect-1.4.32.pom
276     If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
277     Required by:
278         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools:sdk-common:30.0.2
279   Could not find javax.inject:javax.inject:1.
280     Searched in the following locations:
281       - https://dl.google.com/dl/android/maven2/javax/inject/javax.inject/1/javax.inject-1.pom
282     If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
283     Required by:
284         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools:sdk-common:30.0.2
285         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:bundletool:1.6.0
286         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:builder:7.0.2
287   Could not find net.sf.kxml:kxml2:2.3.0.
288     Searched in the following locations:
289       - https://dl.google.com/dl/android/maven2/net/sf/kxml/kxml2/2.3.0/kxml2-2.3.0.pom
290     If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
291     Required by:
292         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools:sdk-common:30.0.2
293         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.ddms:ddmlib:30.0.2
294         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.lint:lint-model:30.0.2
295         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.layoutlib:layoutlib-api:30.0.2
296         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:builder:7.0.2 > com.android.tools.build:manifest-merger:30.0.2
297   Could not find org.jetbrains.intellij.deps:trove4j:1.0.20181211.
298     Searched in the following locations:
299       - https://dl.google.com/dl/android/maven2/org/jetbrains/intellij/deps/trove4j/1.0.20181211/trove4j-1.0.20181211.pom
300     If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
301     Required by:
302         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools:sdk-common:30.0.2
303   Could not find xerces:xercesImpl:2.12.0.
304     Searched in the following locations:
305       - https://dl.google.com/dl/android/maven2/xerces/xercesImpl/2.12.0/xercesImpl-2.12.0.pom
306     If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
307     Required by:
308         project : > com.android.tools.build:gradle:7.0.2 > com.android.tools:sdk-common:30.0.2
309   Could not find org.apache.commons:commons-compress:1.20.
310     Searched in the following locations:
311       - https://dl.google.com/dl/android/maven2/org/apache/commons/commons-compress/1.20/commons-compress-1.20.pom
312     If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
313    repositories {
314        mavenCentral()
315        google()
316    }
317
318

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

QUESTION

pip-compile raising AssertionError on its logging handler

Asked 2022-Feb-13 at 12:37

I have a dockerfile that currently only installs pip-tools

1FROM python:3.9
2
3RUN pip install --upgrade pip && \
4    pip install pip-tools
5
6COPY ./ /root/project
7
8WORKDIR /root/project
9
10ENTRYPOINT ["tail", "-f", "/dev/null"]
11

I build and open a shell in the container using the following commands:

1FROM python:3.9
2
3RUN pip install --upgrade pip && \
4    pip install pip-tools
5
6COPY ./ /root/project
7
8WORKDIR /root/project
9
10ENTRYPOINT ["tail", "-f", "/dev/null"]
11docker build -t brunoapi_image .
12docker run --rm -ti --name brunoapi_container --entrypoint bash brunoapi_image
13

Then, when I try to run pip-compile inside the container I get this very weird error (full traceback):

1FROM python:3.9
2
3RUN pip install --upgrade pip && \
4    pip install pip-tools
5
6COPY ./ /root/project
7
8WORKDIR /root/project
9
10ENTRYPOINT ["tail", "-f", "/dev/null"]
11docker build -t brunoapi_image .
12docker run --rm -ti --name brunoapi_container --entrypoint bash brunoapi_image
13root@727f1f38f095:~/project# pip-compile
14Traceback (most recent call last):
15  File "/usr/local/bin/pip-compile", line 8, in <module>
16    sys.exit(cli())
17  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1128, in __call__
18    return self.main(*args, **kwargs)
19  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1053, in main
20    rv = self.invoke(ctx)
21  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1395, in invoke
22    return ctx.invoke(self.callback, **ctx.params)
23  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 754, in invoke
24    return __callback(*args, **kwargs)
25  File "/usr/local/lib/python3.9/site-packages/click/decorators.py", line 26, in new_func
26    return f(get_current_context(), *args, **kwargs)
27  File "/usr/local/lib/python3.9/site-packages/piptools/scripts/compile.py", line 342, in cli
28    repository = PyPIRepository(pip_args, cache_dir=cache_dir)
29  File "/usr/local/lib/python3.9/site-packages/piptools/repositories/pypi.py", line 106, in __init__
30    self._setup_logging()
31  File "/usr/local/lib/python3.9/site-packages/piptools/repositories/pypi.py", line 455, in _setup_logging
32    assert isinstance(handler, logging.StreamHandler)
33AssertionError
34

I have no clue what's going on and I've never seen this error before. Can anyone shed some light into this?

Running on macOS Monterey

ANSWER

Answered 2022-Feb-05 at 16:30

It is a bug, you can downgrade using:

pip install "pip<22"

https://github.com/jazzband/pip-tools/issues/1558

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

QUESTION

How to perform logging in ConfigureServices method of Startup.cs in ASP.NET Core 5.0

Asked 2022-Feb-12 at 09:53

Constructor injection of a logger into Startup works in earlier versions of ASP.NET Core because a separate DI container is created for the Web Host. As of now only one container is created for Generic Host, see the breaking change announcement.

Startup.cs

1public class Startup
2{
3    /// &lt;summary&gt; The configuration. &lt;/summary&gt;
4    public IConfiguration Configuration { get; }
5    
6    /// &lt;summary&gt; The web host environment. &lt;/summary&gt;
7    public IWebHostEnvironment WebHostEnvironment { get; }
8
9    public Startup(IConfiguration configuration, IWebHostEnvironment webHostEnvironment)
10    {
11        Configuration = configuration;
12        WebHostEnvironment = webHostEnvironment;
13    }
14
15    public void ConfigureServices(IServiceCollection services)
16    {
17        services.AddServices(Configuration);    // This is a custom method, that adds multiple services to the container.
18    }
19
20    public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILogger&lt;Startup&gt; logger) =&gt;
21    app.UseComponents(env, Configuration, logger);
22}
23

Now as per the MSDN, I have modified my Startup.cs as follows:

1public class Startup
2{
3    /// &lt;summary&gt; The configuration. &lt;/summary&gt;
4    public IConfiguration Configuration { get; }
5    
6    /// &lt;summary&gt; The web host environment. &lt;/summary&gt;
7    public IWebHostEnvironment WebHostEnvironment { get; }
8
9    public Startup(IConfiguration configuration, IWebHostEnvironment webHostEnvironment)
10    {
11        Configuration = configuration;
12        WebHostEnvironment = webHostEnvironment;
13    }
14
15    public void ConfigureServices(IServiceCollection services)
16    {
17        services.AddServices(Configuration);    // This is a custom method, that adds multiple services to the container.
18    }
19
20    public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILogger&lt;Startup&gt; logger) =&gt;
21    app.UseComponents(env, Configuration, logger);
22}
23public class Startup
24{
25    /// &lt;summary&gt; The configuration. &lt;/summary&gt;
26    public IConfiguration Configuration { get; }
27    
28    public ILogger&lt;Startup&gt; Logger { get; set; }
29
30    /// &lt;summary&gt; The web host environment. &lt;/summary&gt;
31    public IWebHostEnvironment WebHostEnvironment { get; }
32
33    public Startup(IConfiguration configuration, IWebHostEnvironment webHostEnvironment)
34    {
35        Configuration = configuration;
36        WebHostEnvironment = webHostEnvironment;
37    }
38
39    public void ConfigureServices(IServiceCollection services)
40    {
41        services.AddSingleton((container) =&gt;
42        {
43            var logger = container.GetRequiredService&lt;ILogger&lt;MyService&gt;&gt;();
44            return new Startup(Configuration, WebHostEnvironment) { Logger = logger };
45        });    // I know this is incorrect, but that my question- how do I correctly access logger in here?
46        services.AddServices(Configuration, Logger);    // Logger =&gt; null
47    }
48
49    public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILogger&lt;Startup&gt; logger) =&gt;
50    app.UseComponents(env, Configuration, logger);
51}
52

StartupExtension.ConfigureServices.cs

1public class Startup
2{
3    /// &lt;summary&gt; The configuration. &lt;/summary&gt;
4    public IConfiguration Configuration { get; }
5    
6    /// &lt;summary&gt; The web host environment. &lt;/summary&gt;
7    public IWebHostEnvironment WebHostEnvironment { get; }
8
9    public Startup(IConfiguration configuration, IWebHostEnvironment webHostEnvironment)
10    {
11        Configuration = configuration;
12        WebHostEnvironment = webHostEnvironment;
13    }
14
15    public void ConfigureServices(IServiceCollection services)
16    {
17        services.AddServices(Configuration);    // This is a custom method, that adds multiple services to the container.
18    }
19
20    public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILogger&lt;Startup&gt; logger) =&gt;
21    app.UseComponents(env, Configuration, logger);
22}
23public class Startup
24{
25    /// &lt;summary&gt; The configuration. &lt;/summary&gt;
26    public IConfiguration Configuration { get; }
27    
28    public ILogger&lt;Startup&gt; Logger { get; set; }
29
30    /// &lt;summary&gt; The web host environment. &lt;/summary&gt;
31    public IWebHostEnvironment WebHostEnvironment { get; }
32
33    public Startup(IConfiguration configuration, IWebHostEnvironment webHostEnvironment)
34    {
35        Configuration = configuration;
36        WebHostEnvironment = webHostEnvironment;
37    }
38
39    public void ConfigureServices(IServiceCollection services)
40    {
41        services.AddSingleton((container) =&gt;
42        {
43            var logger = container.GetRequiredService&lt;ILogger&lt;MyService&gt;&gt;();
44            return new Startup(Configuration, WebHostEnvironment) { Logger = logger };
45        });    // I know this is incorrect, but that my question- how do I correctly access logger in here?
46        services.AddServices(Configuration, Logger);    // Logger =&gt; null
47    }
48
49    public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILogger&lt;Startup&gt; logger) =&gt;
50    app.UseComponents(env, Configuration, logger);
51}
52public static partial class StartupExtension
53{
54    #region Internal Method
55    /// &lt;summary&gt; Adds all the services required by the DemoUsageApp. &lt;/summary&gt;
56    /// &lt;param name=&quot;services&quot;&gt;The services, &lt;see cref=&quot;IServiceCollection&quot;/&gt;.&lt;/param&gt;
57    /// &lt;param name=&quot;configuration&quot;&gt;The configuration, &lt;see cref=&quot;IConfiguration&quot;/&gt;.&lt;/param&gt;
58    /// &lt;param name=&quot;logger&quot;&gt;The logger, &lt;see cref=&quot;ILogger{Startup}&quot;/&gt;.&lt;/param&gt;
59    /// &lt;returns&gt;&lt;/returns&gt;
60    internal static IServiceCollection AddServices(this IServiceCollection services, IConfiguration configuration, ILogger logger)
61    {
62        services.AddDotNetCoreServices(configuration, logger);
63        services.AddCrossCuttingServices(configuration, logger);
64
65        return services;
66    }
67    #endregion Internal Method
68
69    #region Private Methods
70    /// &lt;summary&gt; Adds .NET Core services. &lt;/summary&gt;
71    /// &lt;param name=&quot;services&quot;&gt;The services, &lt;see cref=&quot;IServiceCollection&quot;/&gt;.&lt;/param&gt;
72    /// &lt;param name=&quot;configuration&quot;&gt;The configuration, &lt;see cref=&quot;IConfiguration&quot;/&gt;.&lt;/param&gt;
73    /// &lt;param name=&quot;logger&quot;&gt;The logger, &lt;see cref=&quot;ILogger{Startup}&quot;/&gt;.&lt;/param&gt;
74    /// &lt;returns&gt;&lt;/returns&gt;
75    private static IServiceCollection AddDotNetCoreServices(this IServiceCollection services, IConfiguration configuration, ILogger logger)
76    {
77        logger.LogInformation(&quot;----  Adding .NET Core components  ----&quot;);
78
79        services.AddMvc();
80        services.AddControllers();
81
82        logger.LogInformation(&quot;----  Successfully added .NET Core components  ----&quot;);
83
84        return services;
85    }
86
87    /// &lt;summary&gt; Adds Cross-Cutting services. &lt;/summary&gt;
88    /// &lt;param name=&quot;services&quot;&gt;The services, &lt;see cref=&quot;IServiceCollection&quot;/&gt;.&lt;/param&gt;
89    /// &lt;param name=&quot;configuration&quot;&gt;The configuration, &lt;see cref=&quot;IConfiguration&quot;/&gt;.&lt;/param&gt;
90    /// &lt;param name=&quot;logger&quot;&gt;The logger, &lt;see cref=&quot;ILogger{Startup}&quot;/&gt;.&lt;/param&gt;
91    /// &lt;returns&gt;&lt;/returns&gt;
92    private static IServiceCollection AddCrossCuttingServices(this IServiceCollection services, IConfiguration configuration, ILogger logger)
93    {
94        logger.LogInformation(&quot;----  Adding Cross-Cutting components  ----&quot;);
95
96        services.AddSql(configuration, logger);    //This is a extension methods, that adds Sql services (which are also completely custom) to the application.
97
98        logger.LogInformation(&quot;----  Successfully added Cross-Cutting components  ----&quot;);
99
100        return services;
101    }
102    #endregion Private Methods
103}
104

Question- How do I access Logger in ConfigureServices method of Startup.cs so that I can pass it to other custom extension methods that add custom services to the container?

NOTE: Solution requested for Microsoft and Serilog Logger (optional).

Update 1: As @MathewBeck pointed out in his 2nd comment, I already have the following structure of Program.cs:

1public class Startup
2{
3    /// &lt;summary&gt; The configuration. &lt;/summary&gt;
4    public IConfiguration Configuration { get; }
5    
6    /// &lt;summary&gt; The web host environment. &lt;/summary&gt;
7    public IWebHostEnvironment WebHostEnvironment { get; }
8
9    public Startup(IConfiguration configuration, IWebHostEnvironment webHostEnvironment)
10    {
11        Configuration = configuration;
12        WebHostEnvironment = webHostEnvironment;
13    }
14
15    public void ConfigureServices(IServiceCollection services)
16    {
17        services.AddServices(Configuration);    // This is a custom method, that adds multiple services to the container.
18    }
19
20    public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILogger&lt;Startup&gt; logger) =&gt;
21    app.UseComponents(env, Configuration, logger);
22}
23public class Startup
24{
25    /// &lt;summary&gt; The configuration. &lt;/summary&gt;
26    public IConfiguration Configuration { get; }
27    
28    public ILogger&lt;Startup&gt; Logger { get; set; }
29
30    /// &lt;summary&gt; The web host environment. &lt;/summary&gt;
31    public IWebHostEnvironment WebHostEnvironment { get; }
32
33    public Startup(IConfiguration configuration, IWebHostEnvironment webHostEnvironment)
34    {
35        Configuration = configuration;
36        WebHostEnvironment = webHostEnvironment;
37    }
38
39    public void ConfigureServices(IServiceCollection services)
40    {
41        services.AddSingleton((container) =&gt;
42        {
43            var logger = container.GetRequiredService&lt;ILogger&lt;MyService&gt;&gt;();
44            return new Startup(Configuration, WebHostEnvironment) { Logger = logger };
45        });    // I know this is incorrect, but that my question- how do I correctly access logger in here?
46        services.AddServices(Configuration, Logger);    // Logger =&gt; null
47    }
48
49    public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILogger&lt;Startup&gt; logger) =&gt;
50    app.UseComponents(env, Configuration, logger);
51}
52public static partial class StartupExtension
53{
54    #region Internal Method
55    /// &lt;summary&gt; Adds all the services required by the DemoUsageApp. &lt;/summary&gt;
56    /// &lt;param name=&quot;services&quot;&gt;The services, &lt;see cref=&quot;IServiceCollection&quot;/&gt;.&lt;/param&gt;
57    /// &lt;param name=&quot;configuration&quot;&gt;The configuration, &lt;see cref=&quot;IConfiguration&quot;/&gt;.&lt;/param&gt;
58    /// &lt;param name=&quot;logger&quot;&gt;The logger, &lt;see cref=&quot;ILogger{Startup}&quot;/&gt;.&lt;/param&gt;
59    /// &lt;returns&gt;&lt;/returns&gt;
60    internal static IServiceCollection AddServices(this IServiceCollection services, IConfiguration configuration, ILogger logger)
61    {
62        services.AddDotNetCoreServices(configuration, logger);
63        services.AddCrossCuttingServices(configuration, logger);
64
65        return services;
66    }
67    #endregion Internal Method
68
69    #region Private Methods
70    /// &lt;summary&gt; Adds .NET Core services. &lt;/summary&gt;
71    /// &lt;param name=&quot;services&quot;&gt;The services, &lt;see cref=&quot;IServiceCollection&quot;/&gt;.&lt;/param&gt;
72    /// &lt;param name=&quot;configuration&quot;&gt;The configuration, &lt;see cref=&quot;IConfiguration&quot;/&gt;.&lt;/param&gt;
73    /// &lt;param name=&quot;logger&quot;&gt;The logger, &lt;see cref=&quot;ILogger{Startup}&quot;/&gt;.&lt;/param&gt;
74    /// &lt;returns&gt;&lt;/returns&gt;
75    private static IServiceCollection AddDotNetCoreServices(this IServiceCollection services, IConfiguration configuration, ILogger logger)
76    {
77        logger.LogInformation(&quot;----  Adding .NET Core components  ----&quot;);
78
79        services.AddMvc();
80        services.AddControllers();
81
82        logger.LogInformation(&quot;----  Successfully added .NET Core components  ----&quot;);
83
84        return services;
85    }
86
87    /// &lt;summary&gt; Adds Cross-Cutting services. &lt;/summary&gt;
88    /// &lt;param name=&quot;services&quot;&gt;The services, &lt;see cref=&quot;IServiceCollection&quot;/&gt;.&lt;/param&gt;
89    /// &lt;param name=&quot;configuration&quot;&gt;The configuration, &lt;see cref=&quot;IConfiguration&quot;/&gt;.&lt;/param&gt;
90    /// &lt;param name=&quot;logger&quot;&gt;The logger, &lt;see cref=&quot;ILogger{Startup}&quot;/&gt;.&lt;/param&gt;
91    /// &lt;returns&gt;&lt;/returns&gt;
92    private static IServiceCollection AddCrossCuttingServices(this IServiceCollection services, IConfiguration configuration, ILogger logger)
93    {
94        logger.LogInformation(&quot;----  Adding Cross-Cutting components  ----&quot;);
95
96        services.AddSql(configuration, logger);    //This is a extension methods, that adds Sql services (which are also completely custom) to the application.
97
98        logger.LogInformation(&quot;----  Successfully added Cross-Cutting components  ----&quot;);
99
100        return services;
101    }
102    #endregion Private Methods
103}
104public class Program
105{
106    #region Public Methods
107    /// &lt;summary&gt; Main method, the entry-point of the application. &lt;/summary&gt;
108    /// &lt;param name=&quot;args&quot;&gt;The args &lt;see cref=&quot;string[]&quot;/&gt;&lt;/param&gt;
109    public static void Main(string[] args)
110    {
111        var host = CreateHostBuilder(args).Build();
112        var logger = host.Services.GetRequiredService&lt;ILogger&lt;Program&gt;&gt;();
113        logger.LogInformation(&quot;Host created.&quot;);
114
115        host.Run();
116    }
117
118    /// &lt;summary&gt; Creates the host builder. &lt;/summary&gt;
119    /// &lt;param name=&quot;args&quot;&gt;The args &lt;see cref=&quot;string[]&quot;/&gt;&lt;/param&gt;
120    /// &lt;returns&gt;&lt;/returns&gt;
121    public static IHostBuilder CreateHostBuilder(string[] args) =&gt;
122        Host.CreateDefaultBuilder(args)
123            //.ConfigureLogging(loggingBuilder =&gt;
124            //{
125            //    loggingBuilder.ClearProviders();
126            //    loggingBuilder.AddConsole();
127            //    loggingBuilder.AddDebug();
128            //    loggingBuilder.AddEventLog();
129            //    loggingBuilder.AddEventSourceLogger();
130            //})
131            .ConfigureWebHostDefaults(webBuilder =&gt;
132            {
133                webBuilder.UseStartup&lt;Startup&gt;();
134                webBuilder.UseConfiguration(GetConfiguration());
135            });
136    #endregion Public Methods
137
138    #region Private Methods
139    /// &lt;summary&gt; Gets the configuration. &lt;/summary&gt;
140    /// &lt;returns&gt;&lt;/returns&gt;
141    private static IConfiguration GetConfiguration()
142    {
143        var env = Environment.GetEnvironmentVariable(&quot;ASPNETCORE_ENVIRONMENT&quot;) ?? &quot;Development&quot;;
144        var builder = new ConfigurationBuilder()
145            .AddJsonFile(&quot;appsettings.json&quot;, true, true)
146            .AddJsonFile($&quot;appsettings.{env}.json&quot;, true, true);
147
148        return builder.Build();
149    }
150    #endregion Private Methods
151} 
152

ANSWER

Answered 2021-Oct-05 at 16:00

If you are using NLog the easiest way to log in you startup.cs is to add private property.

1public class Startup
2{
3    /// &lt;summary&gt; The configuration. &lt;/summary&gt;
4    public IConfiguration Configuration { get; }
5    
6    /// &lt;summary&gt; The web host environment. &lt;/summary&gt;
7    public IWebHostEnvironment WebHostEnvironment { get; }
8
9    public Startup(IConfiguration configuration, IWebHostEnvironment webHostEnvironment)
10    {
11        Configuration = configuration;
12        WebHostEnvironment = webHostEnvironment;
13    }
14
15    public void ConfigureServices(IServiceCollection services)
16    {
17        services.AddServices(Configuration);    // This is a custom method, that adds multiple services to the container.
18    }
19
20    public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILogger&lt;Startup&gt; logger) =&gt;
21    app.UseComponents(env, Configuration, logger);
22}
23public class Startup
24{
25    /// &lt;summary&gt; The configuration. &lt;/summary&gt;
26    public IConfiguration Configuration { get; }
27    
28    public ILogger&lt;Startup&gt; Logger { get; set; }
29
30    /// &lt;summary&gt; The web host environment. &lt;/summary&gt;
31    public IWebHostEnvironment WebHostEnvironment { get; }
32
33    public Startup(IConfiguration configuration, IWebHostEnvironment webHostEnvironment)
34    {
35        Configuration = configuration;
36        WebHostEnvironment = webHostEnvironment;
37    }
38
39    public void ConfigureServices(IServiceCollection services)
40    {
41        services.AddSingleton((container) =&gt;
42        {
43            var logger = container.GetRequiredService&lt;ILogger&lt;MyService&gt;&gt;();
44            return new Startup(Configuration, WebHostEnvironment) { Logger = logger };
45        });    // I know this is incorrect, but that my question- how do I correctly access logger in here?
46        services.AddServices(Configuration, Logger);    // Logger =&gt; null
47    }
48
49    public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILogger&lt;Startup&gt; logger) =&gt;
50    app.UseComponents(env, Configuration, logger);
51}
52public static partial class StartupExtension
53{
54    #region Internal Method
55    /// &lt;summary&gt; Adds all the services required by the DemoUsageApp. &lt;/summary&gt;
56    /// &lt;param name=&quot;services&quot;&gt;The services, &lt;see cref=&quot;IServiceCollection&quot;/&gt;.&lt;/param&gt;
57    /// &lt;param name=&quot;configuration&quot;&gt;The configuration, &lt;see cref=&quot;IConfiguration&quot;/&gt;.&lt;/param&gt;
58    /// &lt;param name=&quot;logger&quot;&gt;The logger, &lt;see cref=&quot;ILogger{Startup}&quot;/&gt;.&lt;/param&gt;
59    /// &lt;returns&gt;&lt;/returns&gt;
60    internal static IServiceCollection AddServices(this IServiceCollection services, IConfiguration configuration, ILogger logger)
61    {
62        services.AddDotNetCoreServices(configuration, logger);
63        services.AddCrossCuttingServices(configuration, logger);
64
65        return services;
66    }
67    #endregion Internal Method
68
69    #region Private Methods
70    /// &lt;summary&gt; Adds .NET Core services. &lt;/summary&gt;
71    /// &lt;param name=&quot;services&quot;&gt;The services, &lt;see cref=&quot;IServiceCollection&quot;/&gt;.&lt;/param&gt;
72    /// &lt;param name=&quot;configuration&quot;&gt;The configuration, &lt;see cref=&quot;IConfiguration&quot;/&gt;.&lt;/param&gt;
73    /// &lt;param name=&quot;logger&quot;&gt;The logger, &lt;see cref=&quot;ILogger{Startup}&quot;/&gt;.&lt;/param&gt;
74    /// &lt;returns&gt;&lt;/returns&gt;
75    private static IServiceCollection AddDotNetCoreServices(this IServiceCollection services, IConfiguration configuration, ILogger logger)
76    {
77        logger.LogInformation(&quot;----  Adding .NET Core components  ----&quot;);
78
79        services.AddMvc();
80        services.AddControllers();
81
82        logger.LogInformation(&quot;----  Successfully added .NET Core components  ----&quot;);
83
84        return services;
85    }
86
87    /// &lt;summary&gt; Adds Cross-Cutting services. &lt;/summary&gt;
88    /// &lt;param name=&quot;services&quot;&gt;The services, &lt;see cref=&quot;IServiceCollection&quot;/&gt;.&lt;/param&gt;
89    /// &lt;param name=&quot;configuration&quot;&gt;The configuration, &lt;see cref=&quot;IConfiguration&quot;/&gt;.&lt;/param&gt;
90    /// &lt;param name=&quot;logger&quot;&gt;The logger, &lt;see cref=&quot;ILogger{Startup}&quot;/&gt;.&lt;/param&gt;
91    /// &lt;returns&gt;&lt;/returns&gt;
92    private static IServiceCollection AddCrossCuttingServices(this IServiceCollection services, IConfiguration configuration, ILogger logger)
93    {
94        logger.LogInformation(&quot;----  Adding Cross-Cutting components  ----&quot;);
95
96        services.AddSql(configuration, logger);    //This is a extension methods, that adds Sql services (which are also completely custom) to the application.
97
98        logger.LogInformation(&quot;----  Successfully added Cross-Cutting components  ----&quot;);
99
100        return services;
101    }
102    #endregion Private Methods
103}
104public class Program
105{
106    #region Public Methods
107    /// &lt;summary&gt; Main method, the entry-point of the application. &lt;/summary&gt;
108    /// &lt;param name=&quot;args&quot;&gt;The args &lt;see cref=&quot;string[]&quot;/&gt;&lt;/param&gt;
109    public static void Main(string[] args)
110    {
111        var host = CreateHostBuilder(args).Build();
112        var logger = host.Services.GetRequiredService&lt;ILogger&lt;Program&gt;&gt;();
113        logger.LogInformation(&quot;Host created.&quot;);
114
115        host.Run();
116    }
117
118    /// &lt;summary&gt; Creates the host builder. &lt;/summary&gt;
119    /// &lt;param name=&quot;args&quot;&gt;The args &lt;see cref=&quot;string[]&quot;/&gt;&lt;/param&gt;
120    /// &lt;returns&gt;&lt;/returns&gt;
121    public static IHostBuilder CreateHostBuilder(string[] args) =&gt;
122        Host.CreateDefaultBuilder(args)
123            //.ConfigureLogging(loggingBuilder =&gt;
124            //{
125            //    loggingBuilder.ClearProviders();
126            //    loggingBuilder.AddConsole();
127            //    loggingBuilder.AddDebug();
128            //    loggingBuilder.AddEventLog();
129            //    loggingBuilder.AddEventSourceLogger();
130            //})
131            .ConfigureWebHostDefaults(webBuilder =&gt;
132            {
133                webBuilder.UseStartup&lt;Startup&gt;();
134                webBuilder.UseConfiguration(GetConfiguration());
135            });
136    #endregion Public Methods
137
138    #region Private Methods
139    /// &lt;summary&gt; Gets the configuration. &lt;/summary&gt;
140    /// &lt;returns&gt;&lt;/returns&gt;
141    private static IConfiguration GetConfiguration()
142    {
143        var env = Environment.GetEnvironmentVariable(&quot;ASPNETCORE_ENVIRONMENT&quot;) ?? &quot;Development&quot;;
144        var builder = new ConfigurationBuilder()
145            .AddJsonFile(&quot;appsettings.json&quot;, true, true)
146            .AddJsonFile($&quot;appsettings.{env}.json&quot;, true, true);
147
148        return builder.Build();
149    }
150    #endregion Private Methods
151} 
152private readonly NLog.ILogger _log;
153

Then in your constructor just use

1public class Startup
2{
3    /// &lt;summary&gt; The configuration. &lt;/summary&gt;
4    public IConfiguration Configuration { get; }
5    
6    /// &lt;summary&gt; The web host environment. &lt;/summary&gt;
7    public IWebHostEnvironment WebHostEnvironment { get; }
8
9    public Startup(IConfiguration configuration, IWebHostEnvironment webHostEnvironment)
10    {
11        Configuration = configuration;
12        WebHostEnvironment = webHostEnvironment;
13    }
14
15    public void ConfigureServices(IServiceCollection services)
16    {
17        services.AddServices(Configuration);    // This is a custom method, that adds multiple services to the container.
18    }
19
20    public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILogger&lt;Startup&gt; logger) =&gt;
21    app.UseComponents(env, Configuration, logger);
22}
23public class Startup
24{
25    /// &lt;summary&gt; The configuration. &lt;/summary&gt;
26    public IConfiguration Configuration { get; }
27    
28    public ILogger&lt;Startup&gt; Logger { get; set; }
29
30    /// &lt;summary&gt; The web host environment. &lt;/summary&gt;
31    public IWebHostEnvironment WebHostEnvironment { get; }
32
33    public Startup(IConfiguration configuration, IWebHostEnvironment webHostEnvironment)
34    {
35        Configuration = configuration;
36        WebHostEnvironment = webHostEnvironment;
37    }
38
39    public void ConfigureServices(IServiceCollection services)
40    {
41        services.AddSingleton((container) =&gt;
42        {
43            var logger = container.GetRequiredService&lt;ILogger&lt;MyService&gt;&gt;();
44            return new Startup(Configuration, WebHostEnvironment) { Logger = logger };
45        });    // I know this is incorrect, but that my question- how do I correctly access logger in here?
46        services.AddServices(Configuration, Logger);    // Logger =&gt; null
47    }
48
49    public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILogger&lt;Startup&gt; logger) =&gt;
50    app.UseComponents(env, Configuration, logger);
51}
52public static partial class StartupExtension
53{
54    #region Internal Method
55    /// &lt;summary&gt; Adds all the services required by the DemoUsageApp. &lt;/summary&gt;
56    /// &lt;param name=&quot;services&quot;&gt;The services, &lt;see cref=&quot;IServiceCollection&quot;/&gt;.&lt;/param&gt;
57    /// &lt;param name=&quot;configuration&quot;&gt;The configuration, &lt;see cref=&quot;IConfiguration&quot;/&gt;.&lt;/param&gt;
58    /// &lt;param name=&quot;logger&quot;&gt;The logger, &lt;see cref=&quot;ILogger{Startup}&quot;/&gt;.&lt;/param&gt;
59    /// &lt;returns&gt;&lt;/returns&gt;
60    internal static IServiceCollection AddServices(this IServiceCollection services, IConfiguration configuration, ILogger logger)
61    {
62        services.AddDotNetCoreServices(configuration, logger);
63        services.AddCrossCuttingServices(configuration, logger);
64
65        return services;
66    }
67    #endregion Internal Method
68
69    #region Private Methods
70    /// &lt;summary&gt; Adds .NET Core services. &lt;/summary&gt;
71    /// &lt;param name=&quot;services&quot;&gt;The services, &lt;see cref=&quot;IServiceCollection&quot;/&gt;.&lt;/param&gt;
72    /// &lt;param name=&quot;configuration&quot;&gt;The configuration, &lt;see cref=&quot;IConfiguration&quot;/&gt;.&lt;/param&gt;
73    /// &lt;param name=&quot;logger&quot;&gt;The logger, &lt;see cref=&quot;ILogger{Startup}&quot;/&gt;.&lt;/param&gt;
74    /// &lt;returns&gt;&lt;/returns&gt;
75    private static IServiceCollection AddDotNetCoreServices(this IServiceCollection services, IConfiguration configuration, ILogger logger)
76    {
77        logger.LogInformation(&quot;----  Adding .NET Core components  ----&quot;);
78
79        services.AddMvc();
80        services.AddControllers();
81
82        logger.LogInformation(&quot;----  Successfully added .NET Core components  ----&quot;);
83
84        return services;
85    }
86
87    /// &lt;summary&gt; Adds Cross-Cutting services. &lt;/summary&gt;
88    /// &lt;param name=&quot;services&quot;&gt;The services, &lt;see cref=&quot;IServiceCollection&quot;/&gt;.&lt;/param&gt;
89    /// &lt;param name=&quot;configuration&quot;&gt;The configuration, &lt;see cref=&quot;IConfiguration&quot;/&gt;.&lt;/param&gt;
90    /// &lt;param name=&quot;logger&quot;&gt;The logger, &lt;see cref=&quot;ILogger{Startup}&quot;/&gt;.&lt;/param&gt;
91    /// &lt;returns&gt;&lt;/returns&gt;
92    private static IServiceCollection AddCrossCuttingServices(this IServiceCollection services, IConfiguration configuration, ILogger logger)
93    {
94        logger.LogInformation(&quot;----  Adding Cross-Cutting components  ----&quot;);
95
96        services.AddSql(configuration, logger);    //This is a extension methods, that adds Sql services (which are also completely custom) to the application.
97
98        logger.LogInformation(&quot;----  Successfully added Cross-Cutting components  ----&quot;);
99
100        return services;
101    }
102    #endregion Private Methods
103}
104public class Program
105{
106    #region Public Methods
107    /// &lt;summary&gt; Main method, the entry-point of the application. &lt;/summary&gt;
108    /// &lt;param name=&quot;args&quot;&gt;The args &lt;see cref=&quot;string[]&quot;/&gt;&lt;/param&gt;
109    public static void Main(string[] args)
110    {
111        var host = CreateHostBuilder(args).Build();
112        var logger = host.Services.GetRequiredService&lt;ILogger&lt;Program&gt;&gt;();
113        logger.LogInformation(&quot;Host created.&quot;);
114
115        host.Run();
116    }
117
118    /// &lt;summary&gt; Creates the host builder. &lt;/summary&gt;
119    /// &lt;param name=&quot;args&quot;&gt;The args &lt;see cref=&quot;string[]&quot;/&gt;&lt;/param&gt;
120    /// &lt;returns&gt;&lt;/returns&gt;
121    public static IHostBuilder CreateHostBuilder(string[] args) =&gt;
122        Host.CreateDefaultBuilder(args)
123            //.ConfigureLogging(loggingBuilder =&gt;
124            //{
125            //    loggingBuilder.ClearProviders();
126            //    loggingBuilder.AddConsole();
127            //    loggingBuilder.AddDebug();
128            //    loggingBuilder.AddEventLog();
129            //    loggingBuilder.AddEventSourceLogger();
130            //})
131            .ConfigureWebHostDefaults(webBuilder =&gt;
132            {
133                webBuilder.UseStartup&lt;Startup&gt;();
134                webBuilder.UseConfiguration(GetConfiguration());
135            });
136    #endregion Public Methods
137
138    #region Private Methods
139    /// &lt;summary&gt; Gets the configuration. &lt;/summary&gt;
140    /// &lt;returns&gt;&lt;/returns&gt;
141    private static IConfiguration GetConfiguration()
142    {
143        var env = Environment.GetEnvironmentVariable(&quot;ASPNETCORE_ENVIRONMENT&quot;) ?? &quot;Development&quot;;
144        var builder = new ConfigurationBuilder()
145            .AddJsonFile(&quot;appsettings.json&quot;, true, true)
146            .AddJsonFile($&quot;appsettings.{env}.json&quot;, true, true);
147
148        return builder.Build();
149    }
150    #endregion Private Methods
151} 
152private readonly NLog.ILogger _log;
153_log = NLog.LogManager.GetCurrentClassLogger();
154

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

Community Discussions contain sources that include Stack Exchange Network

Tutorials and Learning Resources in Logging

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

Share this Page

share link

Get latest updates on Logging