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

Popular New Releases in Logging

logrus

v1.8.1

zap

v1.21.0

spdlog

Version 1.10.0

logstash

Logstash 8.1.3

loguru

0.6.0

Popular Libraries in Logging

logrus

by sirupsen doticongodoticon

star image 18617 doticonMIT

Structured, pluggable logging for Go.

zap

by uber-go doticongodoticon

star image 15297 doticonMIT

Blazing fast, structured, leveled logging in Go.

spdlog

by gabime doticonc++doticon

star image 14199 doticonNOASSERTION

Fast C++ logging library.

logger

by orhanobut doticonjavadoticon

star image 12966 doticonApache-2.0

✔️ Simple, pretty and powerful logger for android

logstash

by elastic doticonrubydoticon

star image 12801 doticonNOASSERTION

Logstash - transport and process your logs, events, or other data

loguru

by Delgan doticonpythondoticon

star image 11191 doticonMIT

Python logging made (stupidly) simple

fluentd

by fluent doticonrubydoticon

star image 11095 doticonApache-2.0

Fluentd: Unified Logging Layer (project under CNCF)

beats

by elastic doticongodoticon

star image 10916 doticonNOASSERTION

:tropical_fish: Beats - Lightweight shippers for Elasticsearch & Logstash

pino

by pinojs doticonjavascriptdoticon

star image 9114 doticonNOASSERTION

🌲 super fast, all natural json logger

Trending New libraries in Logging

tslog

by fullstack-build doticontypescriptdoticon

star image 608 doticonMIT

📝 tslog - Expressive TypeScript Logger for Node.js.

quill

by odygrd doticonc++doticon

star image 583 doticonMIT

Asynchronous Low Latency C++ Logging Library

ZLogger

by Cysharp doticoncsharpdoticon

star image 509 doticonMIT

Zero Allocation Text/Strcutured Logger for .NET Core and Unity, built on top of a Microsoft.Extensions.Logging.

Logcat

by getActivity doticonjavadoticon

star image 351 doticonApache-2.0

Android 日志打印框架,在手机上可以直接看到 Logcat 日志啦

Kermit

by touchlab doticonkotlindoticon

star image 311 doticonApache-2.0

Kermit by Touchlab is a Kotlin Multiplatform centralized logging utility.

laurel

by threathunters-io doticonrustdoticon

star image 273 doticonGPL-3.0

Transform Linux Audit logs for SIEM usage

fmtlog

by MengRao doticonc++doticon

star image 266 doticonMIT

fmtlog is a performant fmtlib-style logging library with latency in nanoseconds.

TLog

by dromara doticonjavadoticon

star image 232 doticonMIT

Lightweight distributed log label tracking framwork

Dockter

by oslabs-beta doticontypescriptdoticon

star image 221 doticonMIT

A low-overhead, open-source Docker log management tool

Top Authors in Logging

1

apache

16 Libraries

star icon4656

2

pinojs

16 Libraries

star icon10575

3

serilog

14 Libraries

star icon6941

4

fluent

12 Libraries

star icon12843

5

aliyun

11 Libraries

star icon680

6

microsoft

10 Libraries

star icon560

7

elastic

10 Libraries

star icon24100

8

NLog

8 Libraries

star icon5835

9

datalust

8 Libraries

star icon222

10

Financial-Times

8 Libraries

star icon99

1

16 Libraries

star icon4656

2

16 Libraries

star icon10575

3

14 Libraries

star icon6941

4

12 Libraries

star icon12843

5

11 Libraries

star icon680

6

10 Libraries

star icon560

7

10 Libraries

star icon24100

8

8 Libraries

star icon5835

9

8 Libraries

star icon222

10

8 Libraries

star icon99

Trending Kits in Logging

C++ Logging Libraries help manage errors when running on the server side. It helps track, analyze, & manage real-time errors and builds high-quality code. 


Here is the list of best C++ logging libraries to help debug, understand the micro-level working of a program, track errors and status messages created during runtime, see the results of each independent process, and more. 

Benefits of Logging Libraries

  • Multithreading/async writing to log files.
  • Support of multiple log levels and types.
  • Configuration and trace filtering from config file. 
  • Help of log rotation and time stamping.
  • Singleton Class and thread safety in a multithreading environment.
  • Good documentation and library support itself.

 

Check out our recommendation of the 15 best C++ Logging libraries available for developers:

spdlog

  • spdlog optimizes for speed and has low memory overhead.   
  • spdlog supports various logging backends, including stdout, files, and rotating files.   
  • It allows you to choose the appropriate backend based on your logging needs.   

glog   

  • Google's glog is a C++ implementation of logging.   
  • It provides advanced features for logging messages from C++ code.  
  • It offers features such as logging levels and log message formatting.   

easyloggingpp 

  • The design aims to be lightweight and have minimal impact on performance.   
  • Include it in your C++ code without needing a separate compilation.   
  • It allows you to customize logging behavior through configuration files. 

NanoLog   

  • NanoLog is a C++ library used in Logging applications.    
  • NanoLog has no bugs, no vulnerabilities, and medium support.   
  • Nanolog is a performant nanosecond scale logging system for C++.  

palanteer

  • Palanteer is a C++ library used in Performance Management, Monitoring applications.   
  • Palanteer is a set of efficient tools to improve software quality.   
  • It has no vulnerabilities, and it has a medium support.   

plog   

  • The designers of Plog designed it to be small but flexible.   
  • It prefers templates to interface inheritance.   
  • It has no vulnerabilities or bugs.  

log4cplus   

  • log4cplus is a C++ library used in Logging applications.   
  • It is simple to use C++17 logging API, providing thread-safe, flexible, and granular control.  
  • The Java log4j API models it.   

g3log

  • G3log aims to provide high-performance logging. It is well-suited for real-time and low-latency systems.   
  • G3log provides various configuration options. It allows developers to customize logging behavior according to their needs.   
  • The designers of G3log have made it thread-safe. It enables many threads to log without causing data corruption or undefined behavior.   

quill 

  • Quill allows users to create and edit content using word processor tools like bold text.   
  • Developers can customize Quill with its modular architecture.   
  • It extends its functionality by adding or removing modules.   

reckless   

  • Reckless is a C++ library used in Logging applications.   
  • Reckless has no bugs, it has no vulnerabilities, and it has low support.   
  • Reckless is a low-latency, high-throughput logging library.   

log4z

  • The designers of Log4z intended it to be lightweight and efficient. It makes it suitable for high-performance applications.   
  • The library provides an easy-to-use API for logging.   
  • The library supports log rolling and log file management.   

binlog  

  • Logging events or data in binary is a technique that uses something other than readable text.   
  • Binary logs are efficient in terms of storage.   
  • It can be useful when logging large volumes of data is important. 

timemory

  • You can add a set of macros and functions to C++.   
  • TiMemory provides timers to measure the wall clock, CPU, and user time.   
  • It can track memory allocations and deallocations.  

tracetool  

  • People use TraceTool for software debugging and tracing purposes.    
  • Developers can use it to log and visualize data while running their applications.    
  • The library is especially helpful in debugging complex software systems.  

lwlog: 

  • The term "lwlog" can refer to a logging library or a specific implementation in a project or codebase. 
  • "lwlog" is a custom logging library or a framework specific to a project. 
  • How it works and is used depends on how it is implemented and documented in that project

FAQ:   

1. What are logging libraries, and why are they important?   

Logging libraries are software tools or frameworks. It provides developers with an efficient and standardized way to log messages. They are important in software development, especially in these areas: 

  • Debugging and Troubleshooting   
  • Monitoring and Maintenance   
  • Auditing and Compliance   
  • Historical Analysis   
  • Security   
  • Performance Optimization   

   

2. How do I create a logging module for my project?   

A logging module helps save important details, errors, and events for your project. It can be invaluable for debugging and monitoring the application's behavior. Python provides a built-in logging module that you can use. Here's a step-by-step guide to creating a basic logging module for your project:   

  • Import the logging module: To begin, import the logging module into your script or module.   
  • Set up logging: Choose how to log messages and configure logging settings. You can do this in the main part of your script or a separate configuration file.   

   

3. What does Jakarta Commons Logging do, and how can you use it?   

Jakarta Commons Logging (JCL) is a logging framework for Java applications. The Apache Commons project developed it. It provides a simple and consistent logging interface. This can work with logging tools, like Log4j, java.util.logging, and more.  

Here's how you can use Jakarta Commons Logging in your Java application:   

  • Include Jakarta Commons Logging dependency   
  • Import and use the logging classes   
  • Create logger instances   
  • Log messages   
  • Configure the logging implementation   
  • Switching logging implementations   

   

4. Can I configure various log levels in a logging library?   

Yes, in most logging libraries, you can configure various log levels. You can use log levels to group log messages by how serious, important, or meaningful they are. The most common log levels are:   

  • DEBUG   
  • INFO   
  • WARNING   
  • ERROR   
  • CRITICAL   

   

5. How do I produce meaningful log messages that aid in debugging software issues?   

Producing meaningful log messages is crucial for effective debugging of software issues. Well-structured and informative logs can reduce the time and effort required to diagnose. Here are some guidelines to help you create meaningful log messages:   

  • Be Clear and Specific   
  • Use Log Levels   
  • Include Timestamps   
  • Add Contextual Information   
  • Stack Traces   
  • Consistency   

   

6. Do you know of any free logging tools I can use with my project?   

Here are some recommendations:   

  • Log4j   
  • Logback   
  • Logstash   
  • Fluentd   
  • Sentry   
  • Graylog   

   

7. How do you create a Pino logger instance for your projects?   

To create a Pino logger instance for your projects, you'll need to follow these steps:   

  • Install Pino   
  • Import Pino   
  • Create the logger instance   
  • Use the logger   
  • Customize the logger  

Java Logging libraries help debug and troubleshoot the application in the production environment. It allows users to debug the code and analyze the results depending on the logs collected during runtime. The requirement for logging has increased in recent years because of the application complexity being developed because of the demand from auditors and customers for detailed information about the happenings of the system.  


The Java Logging libraries help monitor, debug, and analyze application behaviour. It is a library used for writing log messages. It offers a simple API that can be used for logging messages on various levels. It offers various logging levels like debug, warns, fatal, error, and info for categorizing the importance of log messages. It allows developers to filter log messages depending on their source, severity, and other criteria to make finding the information they require easier.   


Here is the list of the 14 best Java Logging libraries that are handpicked to help developers: 

logger: 

  • Is a software library that offers functionalities for logging messages and events within an application.  
  • Offers a set of methods and classes which allow the developers to log information about the behavior and state of the application and any exceptions or errors to occur. 
  • Can configure the logger for controlling the level of logging, the destination of the log output, and the format of the log messages.  

graylog2-server: 

  • Is an open source log management tool that will allow developers to collect, process, and analyze log data from different sources in real time.  
  • Offers a web-based interface for configuring and managing the logging pipeline.  
  • Allows developers to collect log data from different sources like applications, network devices, and servers and store it in a centralized location for troubleshooting and easy analysis.   

logging-log4j2: 

  • Is a Java-based logging utility library used for logging messages from a Java application.  
  • Is designed to produce minimal garbage during logging, which reduces the impact on the application’s memory usage.  
  • Can be customized to include contextual information like the application name, log level, and thread name. 

xLog: 

  • Is an open source library that offers a simple and efficient way to log events in Android apps.  
  • Supports customizable log levels allowing developers to filter log events depending on their importance and severity.  
  • Is designed to be thread-safe, which means multiple threads can log events without interfering with each other.   

p6spy: 

  • Is a Java library that offers a proxy driver between the actual JDBC driver and the application.  
  • Allows to intercept and log all the SQL statement and their parameters to the database.   
  • Can log the performance statistics and execution time of every SQL statement, which can help identify inefficient database access patterns and slow queries. 

gpslogger: 

  • Allows users to record their speed, altitude, and location in real time and store it locally on the device or remotely on a cloud-based service. 
  • Allows users to customize the logging interval for GPS data that can help converse storage space and battery life. 
  • Supports various logging modes like time-based, manual, and distance-based logging, offering users flexibility in logging their GPS data. 

log-synth: 

  • Is a logging library for Java which offers a simple way to log events in your application that allows easy monitoring and troubleshooting.  
  • Supports different logging levels, which will allow you to control the amount of detail that is logged.  
  • Allows you to configure logging to output for multiple destinations like a remote server or files. 

Chronicle-Logger: 

  • Is a Java logging library designed for low latency and high-performance logging. 
  • Offers a simple and flexible API for logging, allowing developers to log messages at various severity levels like warning, error, debug, and info.  
  • Can achieve this by using off-heap memory for storing log messages, which reduces the garbage collection overhead and improves performance. 

nRF-Logger-API: 

  • Is a software library designed for use with Nordic Semiconductor’s nRF53 and nRF52 series of microcontrollers.  
  • Supports multiple log levels, allowing developers to filter log output based on severity easily.  
  • Is available under the BSD 3-Clause license, a permissive open source license that allows for both non-commercial and commercial use of the software.   

fluent-logger-java: 

  • Is a Java library for logging events to Fluentd, a popular open source data collector. 
  • Offers a simple interface for Java applications to send log events to a Fluentd server which can then route the events to different destinations like Hadoop, Elasticsearch, or other processing or storage systems. 
  • Supports UDP and TCP protocols for communicating with the Fluentd servers. 

Sensor-Data-Logger: 

  • Is a software tool designed to facilitate data logging from sensors in embedded systems. 
  • Is typically used in applications where a microcontroller is used for acquiring sensor data and storing it in some form of non-volatile memory. 
  • Offers a set of functions that can be used for configuring the logging parameters, like the number of samples to be acquired, the format of the data to be logged, and the sampling frequency. 

ecs-logging-java: 

  • Is a software tool designed for facilitating logging in Java applications using the Elastic Common Schema. 
  • Is a specification for structured logging which offers a standardized method for defining and organizing log events. 
  • Offers a set of functions that can be used for creating ECS-compliant log events in Java applications. 

commons-logging: 

  • A Java-based logging framework offers a simple and consistent interface for logging across different Java-based applications.  
  • Offers a set of standard logging levels like INFO, ERROR, DEBUG, FATAL, and WARN, which can be used for log messages with varying degrees of importance.  
  • Supports message parameterization and localization, allowing for more expressive and flexible log messages. 

owasp-security-logging: 

  • Is a Java-based logging framework specifically designed to improve the security of Java-based applications by offering various security-focused logging features.   
  • Includes logging of events like cross-site scripting, SQL injection attacks, and failed login attempts.  
  • Offers built-in support for OWASP's top 10 security risks like broken authentication and session management, injection attacks, cross-site scripting, and many more. 

A logging library helps record events within an application and identify errors. It helps track the flow of an application. Logging libraries can log the event and store or send data. It can help analyze results and notify users of errors or progress. This helps debug applications and measure performance. It gives organizations a deeper understanding of their application.   

Types of node.js logging libraries:  

  • Winston is a popular, versatile logging library for Node.js. It is a simple and customizable logging library for many projects and applications. Express-winston middleware is a popular npm library. It extends an inbuilt logging library in NodeJS.  
  • Bunyan is a popular Nodejs logging library. It advocates for structured logs, making them easier to parse and query. With Bunyan, you can install, create, and configure logs to best suit your needs.  
  • Pino is a modern logging library for Node.js applications. It provides an efficient logging system with a powerful set of features. The features like colorized logging, logging to JSON objects, and log redirection capabilities. Pino also provides a Pino-pretty CLI tool that helps to format the logs in a readable manner.  
  • Log4js is a popular Node.js logging library for JavaScript applications. It supports various log levels, asynchronous logging, and stack trace printing. It also supports custom error levels, runtimes, web frameworks, and more. It supports script-loading systems for easy installation via the NPM command.  
  • Logflare is a Nodejs library for configurable logging and centralized monitoring of logs. It harnesses the power of Nodejs for its logging and monitoring capabilities. It will provide an optimal logging and monitoring experience for your application. It supports cloud-based monitoring services such as AWS Cloudwatch. The library offers a CLI tool, making it easier to debug problems.  
  • The NPM log Library is one of the most popular Nodejs libraries. It helps in logging and Typescript. It provides its own Typescript skill in using this library. This allows developers to configure the library without relying on code configurations.  

 

Most of these libraries have good app support and frequent updates. Furthermore, some libraries offer to log in to external services. We can install Nodejs-logging-library via the npm command in the application. 

 

These libraries allow you to import logs from several sources into the framework. Developers can also create custom filters for working with log data. Another option is to use a Log management tool, like Sematext Logsene. It provides log redirection capabilities to filter out specific log events. A Node.js logging library supports the concept of child loggers. This means that one can create structured loggers instead of creating a logging instance. 

 

CommonJS is a JavaScript specification to share code between files and packages. It is the driving force behind developing modules and packages for applications. With CommonJS, developers can organize code into modules, which we can import and use. 

 

Logging functions are important for debugging and tracking issues in Node.js applications. For a Node.js application, various logging libraries are available. It makes it important to choose the right library for the task.  

Types of logging libraries:  

  • Text-based logging libraries:  

Text-based logging libraries are simple and easy to use. They use plain text for logging messages and have limited formatting capabilities. Examples include syslog, log4j, and PHP-Logger.  

  • Object-oriented logging libraries:  

Object-oriented logging libraries offer advanced features. It supports structured logging in various languages. Examples include Log4j, Logback, and Apache Log4j.  

  • Cloud-based logging libraries:  

Cloud-based logging libraries support collecting, routing, and storing log records. Examples include Amazon CloudWatch, Loggly, and Splunk.  

  • Machine-learning-enabled libraries:  

It looks for anomalies or suspicious activities. These libraries can interpret and analyze log records in real time. Examples include Amazon Kinesis Analytics, Google Cloud Platform Logging, and IBM's Watson Explorer. 

Features available in different logging libraries: 

  • Logging levels  

Most logging libraries have predefined logging levels that can differentiate between log messages. Common logging levels include DEBUG, INFO, WARN, ERROR, and FATAL.  

  • Logging format  

Different logging libraries support different formats for logging messages. This can include plain text, structured formats such as JSON, or proprietary formats.  

  • Logging destinations  

Logging libraries can support different log destinations. Destinations include local files, remote services, database tables, cloud storage, and more.  

  • Automated log rotation  

Many logging libraries support automated log rotation. It can reset the file path, truncate long log files, delete older ones, and more.  

  • System-specific logging  

This feature allows logging either to a certain OS or uses system-specific APIs. It helps collect log messages.  

  • Logging server  

These logging libraries can run a separate log server. It ingests and processes the log records.  

Key Tips for Choosing the right logging libraries:  

  • Determine your project's specific logging requirements and research the available logging libraries.  
  • Check the logging libraries feature list. Make sure that the logging library provides the features that you need.  
  • Establish a good understanding of the logging library's API. Examine the level of active development of the library.  
  • Consider the logging library's compatibility with other components of your project. And consider the types of logging data the library can produce.  
  • Check the logging library's flexibility and ensure that the library is secure.  

Different ways that we can use the logging libraries:  

  • Application Logging:  

Application logging enables developers to capture events. It captures errors occurring in applications to debug them. We write application logs to a specific log file. We can access it through the application or system administrator.  

  • System Logging:  

System logging captures more comprehensive information about the system. You can get information like service availability and user authentication requests. It can also be network traffic, kernel activity, and system performance. System logging helps monitor system health, track resource usage, and troubleshoot system issues.  

  • Security Logging:  

Security logging will monitor system activity for any suspicious activity. The activity is like failed login attempts or malicious network intrusions. Organizations use log analytics software to manage the logs generated by network devices. It has to track system activities for audit and regulatory compliance.  

  • Audit Logging:  

Audit logging helps track user actions. The actions like file access or system settings change and compliance. Audit logs can ensure compliance with governmental regulations and industry standards. We will include it as part of an incident response plan.  

  • Debug Logging:  

Debug logging monitors a system's and application's inner workings. It helps find and fix code errors. We can enable this type of logging in the development and testing environment.  

 

Advice on how to use logging libraries to troubleshoot and debug your applications:  

  • Start by understanding the basics and familiarize yourself with logging in your environment.  
  • Consider the different logs available in your library. It helps decide what logging you need for your specific application and environment.  
  • Implement logging in your applications and monitor log files. It has the log files sent to a central log management system.  
  • Set up alerts and log analytics tools so you can query log data.  

 

Key Tips for using logging libraries:  

  • Use Advanced Logging Formats and take Advantage of Machine Learning  
  • Implement Automated Alerts and use a Centralized Logging Platform  
  • Use Logging Aggregation  
  • Leverage Real-Time Analytics  
  • Use Search Tools and leverage Logging Dashboards 


Error tracking involves tracking and logging errors for debugging and troubleshooting purposes. It helps find, diagnose, and get insights about an application's performance or behavior.  

 

An API endpoint is a controller route responsible for serving and creating resources. Node.js logging libraries have a single API endpoint. It allows users to configure the logging library for their application. Many logging libraries provide unique API endpoints. It will allow developers to create custom transports tailored to their needs. 

 

Webpack and Browserify are popular module bundlers. They are popular and help us to bundle stylesheets, images, and other resources. They also provide code minification, asset optimization, and hash generation capabilities. Webpack and Browserify offer great features to help the application's logging needs.  

 

Logging libraries are an invaluable tool for any software development project. The benefits of using a logging library include: 

  • context-specific filtering and searching of data, 
  • improved readability of log files, and 
  • better performance. 


This logging library technology is a powerful and versatile tool for developers. It offers an easy-to-use interface for logging across various applications and major OS. It features various customization options. Furthermore, it enables efficient data storage, tracking, and analysis over long periods. Additionally, logging libraries are a great way to keep track of user activity and errors. It will allow developers to identify and respond to user interaction patterns. This technology is an invaluable resource to streamline their logging needs.  

 

Let's look at each library in detail. The links below provide access to package commands, installation notes, and code snippets. 

winston  

  • Enables writing log messages to files, databases, memory streams, and email servers.  
  • Offers features and plugins to add capabilities. You can get capabilities like exception handling, express middleware, and custom filters.  
  • It provides semantic levels. It allows the user to define message precedence and assign data types to each log message.  

pino  

  • It uses msgpack for encoding, which is much more efficient than JSON. So, we can store log entries in a smaller, more compact format.  
  • It is a focused logging library that supports a few key features.  
  • It has a very fast terminal output (with color), and we can pipe it to various destinations.  

debug  

  • Can limit log output to specific namespaces while other libraries print everything.  
  • It provides better formatting of log output, while other libraries often lack options.  
  • It doesn't need to set up a logging destination.  

prompts  

  • It has a pluggable logger. It enables users to customize their logging stack to match their specific needs.  
  • Provides a built-in template system for formatting log messages.  
  • It supports automatic message filtering. It filters based on criteria like log level, message type, or custom tags.  

morgan  

  • It is a non-blocking logging library. It is because it does not block other processes while logging messages.  
  • Allows developers to choose from different logging formats. The formats like Apache Common Log Format and others.  
  • It supports log rotation, which helps to control the disk space consumed by the log files.  

node-bunyan  

  • You can log into a browser, displaying log messages in the browser window in its native format.  
  • Can create child loggers that inherit configurations from the parent logger.  
  • It allows you to log in to many streams at the same time.  

log4js-node  

  • It has optional support for log filtering, where developers can set up logging rules.\  
  • It allows for asynchronous logging. It allows applications to maintain their performance as the logging activity increases.  
  • It offers support for log levels.  

tracer  

  • Logs stack traces, performance metrics, and other runtime information for Node.js applications  
  • Features like built-in distributed tracing allow deep insights into distributed transactions.  
  • It has a web-based UI to investigate and analyze logs in real-time.  

FAQ 


What is a logging library, and why should I use it for my Nodejs application?  

A logging library is a collection of components, tools, and APIs. It allows you to add logging capabilities to your Nodejs application. It allows you to output detailed log messages, capture errors, and track user actions. Logging libraries can help you identify issues and identify potential performance bottlenecks. It even helps in debugging issues that arise. With the help of a logging library, you can reduce development and debugging time.  


Is there a simple and fast JSON logging library available for Nodejs?  

Yes, many simple and fast JSON logging libraries are available for Nodejs. Popular options include Winston, Bunyan, and Loggly.  

 

How do I filter logs generated by my Nodejs application?  

One way to filter logs generated by a Node.js application is to use a library. The library is like winston or node-bunyan. It provides filtering capabilities and the ability to create custom filters. Additionally, several third-party logging services. The logging services like Splunk, LogDNA, and Papertrail. It makes filtering, adding, and visualizing logs from a Node.js application easy.  

 

What are the logging levels supported by the popular logging libraries in Nodejs?  

Popular logging libraries like Winston and Bunyan support the following logging levels. You can get support for levels like Trace, Debug, Info, Warn, Error, Fatal, and Silent.  

 

Are there any console logging methods available in Nodejs to debug applications?  

Yes, several console logging methods are available in Node.js to debug applications. These include console.log(), console.info(), and console.warn(). It also includes console.error(), and console.time()/console.timeEnd().  

 

Can we implement centralized logging with Nodejs?  

Yes, we can implement centralized logging with Node.js. We can use logging frameworks like ELK Stack with Node.js to set up a centralized logging system. Various modules like Winston, Bunyan, and Log4js are available. Each module allows users to create log files and messages and trace errors. It also helps rotate logs and format output to store the logs. It helps to log, and we can integrate Node.js projects for centralized logging.  

 

What log management tools are available for handling logs generated?  

The log management tools available for handling logs generated include:  

  • Papertrail: It is a cloud-hosted log management solution. It can help you add, view, and analyze your logs.  
  • ELK Stack: The ELK stack is a powerful log management solution. It enables real-time log analysis and visualization.  
  • Loggly: Loggly is a cloud-based log monitoring and analytics platform. It allows you to add and search your logs in real-time.  
  • Logsene: Logsene is an online log analysis service. It helps you monitor, analyze, and search logs.  
  • Splunk: Splunk is an award-winning log management platform. It enables you to collect, monitor, and analyze large volumes of logs in real-time.  
  • LogDNA: LogDNA is a cloud-based log analysis platform. It enables you to search and visualize your node application logs.  
  • Fluentd: Fluentd is an open-source log management platform. It lets you collect, route, and store log data from many sources.  

 

How can we use Winston with Express to manage logs in real-time?  

We can use Winston with Express to manage real-time logs. We can set up a Winston logger instance with the Express server as the transport option. This will ensure that we log all requests with the necessary details. The details like the time we make, the request type, and the route or path requested. Also, it can be the user's IP address and the request's response time. We can also configure Winston to print logs. It helps the console in the development environment and stores log-to files. It helps in remote log aggregation services like Loggly and Logentries in production.  

 

How does CommonJS help handle log data from many sources using one logger instance?  

CommonJS helps handle log data from many sources by providing a single module. We can export and reuse it across many files. This allows using the same logger instance in different files without creating many instances. So, it provides a single place for logging all log data from many sources. It helps simplify the process and reduce the code we need to write.  

 

What are the best practices while working with logger instances? How can they take action to improve log performance in node applications?  

  • Avoid Logging Sensitive Data  
  • Print Logging Messages to Many Destinations.  
  • Use the Appropriate Level of Logging  
  • Use Data Format  
  • Use Logging Hosts  
  • Automate Logging Process  
  • Perform Regular Log Pruning 

 

In JavaScript, logging is the logger class that provides logging functionality for the application. It can display errors, warnings, and debug messages. Here are the best JavaScript logging libraries for your toolkit to perform logging.  


For debugging the utility model: 

  1. Consider using debug library. 
  2. We should consider using one of the popular libraries in JavaScript called signals. 
  3. For a lightweight and configuration-free output level, consider using the loglevel library. 


Webpack is more flexible than Browserify. It is because it uses a JavaScript config file to define bundling workflows. The debugging process is to find and fix errors or bugs in the code of any software. JavaScript allows us to use throw with any arguments. So our custom error levels classes do not need to inherit from the error log.  


We have identified libraries based on popularity, flexibility, and coverage across the tools. Let's look at each library in detail. The links below help to access package commands, installation notes, npm, and codesnippets.  

debug:  

  • It is a JavaScript debugging utility modeled after Node.js core's debugging technique.  
  • It works in Node.js and web browsers.  
  • Exposes a function; pass this function the name of our module.  
  • It will return a decorated version of the console error for us. It helps toggle the debug output for different parts of our module and the module as a whole.  

signale:  

  • It is hackable and configurable to the core. We can use Signale for logging purposes like status and reporting. It helps in handling the output rendering process.  
  • Delivers clean and beautiful standard output.  
  • Secret and sensitive information filtering.  
  • Overridable configuration per file and logger.  

node-bunyan:  

  • It is a simple JSON logging library for node.js services.  
  • It has wide platform support and good facilities for structured log messages.  
  • We should structure server logs.  
  • A Node.js module for logging in JSON and a Bunyan CLI tool to view those logs.  

loglevel:  

  • Minimal, lightweight, simple logging for JavaScript.  
  • Friends with level-based logging and filtering, with none of the console's downsides.  
  • It is a barebone, reliable everyday logging library.  
  • It does not let us reconfigure appends or add complex log filtering rules.  

hypercore:  

  • It is a secure logging library, distributed append-only log.  
  • Mainly built for sharing large datasets and streams of real-time logger data.  
  • It aims to do one thing well - distributing a stream of data.  
  • Uses signed Merkle trees to verify log integrity in real time.  

electron-log:  

  • It is a simple logging module for our electron or NW.js application.  
  • It has no dependencies and no complicated configuration.  
  • We can use it in any node.js application without Electron.  

log-update:  

  • Log by overwriting the last output in the terminal.  
  • Useful for generating progress bars and animations.  
  • One of the most important libraries for our node.js application.  
  • Rendering plays a vital role in our application.  

FAQ:  

1. What is a logging library, and why should I use one?  

It is a simple JSON logging library for Node.js services.  


2. What are the best practices for using a logging library?  

  • Define log levels.  
  • Exclude sensitive information.  
  • Timestamp.  
  • Use structured logging.  
  • Creating basic logs.  
  • Test your logs.  
  • Configure Winston with Morgan.  


3. How does the logging framework of Nodejs work?  

  • LogLevel.  
  • Error.  
  • Debugging.  
  • Information.  
  • Stack trace.  
  • Timestamp.  


4. How can we use Browserify to create a custom logging library?  

It allows developers to write and use Node.js-style modules that compile for the browser. Its features include a CLI for pretty printing and serializers. It supports many runtimes besides Node.js, like Webpack and Browserify.  


5. Where are server logs stored, and how can we access them?  

We can store logs in an available location, no matter the size of our JavaScript application. If not, we avoid having all the relevant information when something goes wrong.  

Here are the best open-source Node.js logging libraries for your web application. You can use these libraries in Nodejs - JavaScript runtime environment for logging functions such as debugging, troubleshooting, monitoring applications, and more.

 

These libraries provide developers with diverse options for logging their applications, allowing them to understand better what is happening in their code. Moreover, these libraries help you get detailed insights into how the application is performing. Also, you will be able to test how the application behaves under various loads in the production environment. At the same time, they help improve your applications' performance through error tracking and troubleshooting. These open-source Node.js logging libraries also provide support for multiple transports. 

 

We have curated a list of top and trending Node.js libraries for logging based on popularity, licensing, and unique features to enable logging in your application for debugging the code when required:

Pino:

  • Used to log the statements in an easy-to-read JSON format.
  • A fast and efficient logging library that uses a binary format for log messages.
  • Provides a simple and extremely fast API.

Winston:

  • Used to perform logging under various levels and formats.
  • A versatile logging library that provides support for multiple transports.
  • Offers advanced logging options.

Bunyan:

  • Used for fast logging in node.js in JSON format.
  • A simple and efficient logging library that uses JSON format for log messages.
  • Offers a CLI (Command Line Interface) tool for viewing the logs.

Loglevel:

  • Used to perform logging operations in both Node.js and the browser.
  • One of Node.js best loggers as it is lightweight and simple.
  • A new version is released whenever new features are added.

Signale:

  • Used to create custom logs by using a JSON object and fields with the logger data.
  • Offers the ability to filter out secretive or sensitive information.
  • Provides timers that help log the timestamp, data, and filename.

Tracer:

  • Used for producing detailed logging messages.
  • These consist of timestamps, file names, line numbers, and method names.
  • Supports file, stream, and MongoDB transport.
  • Provides a color console and filter conditions in logging.

Cabin:

  • Used for the masking of sensitive and critical information in node.js applications.
  • Follows the principle of Bring Your Own Logger (BYOL).
  • Compatible with various other loggers like Axe, Pino, Bunyan, Winston, etc.

Npmlog:

  • Used to perform simple logging operations in Server, Runtime Environment, and node.js applications.
  • Offers various logging levels including, silly, verbose, info, warn, HTTP, and error.
  • Also supports colored 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