Popular New Releases in Animation
animate.css
v4.1.1
manim
ManimGL 1.6.1
anime
v3.2.1
lottie-android
5.0.3
react-spring
v9.4.5-beta.1
Popular Libraries in Animation
by animate-css css
74293
NOASSERTION
🍿 A cross-browser library of CSS animations. As easy to use as an easy thing.
by MisterBooo java
66783
Demonstrate all the questions on LeetCode in the form of animation.(用动画的形式呈现解LeetCode题目的思路)
by 3b1b python
43754
MIT
Animation engine for explanatory math videos
by juliangarnier javascript
40224
MIT
JavaScript animation engine
by airbnb java
32616
Apache-2.0
Render After Effects animations natively on Android and iOS, Web, and React Native
by pmndrs typescript
22856
MIT
✌️ A spring physics based React animation library
by airbnb swift
22558
Apache-2.0
An iOS library to natively render After Effects vector animations
by HeroTransitions swift
20722
MIT
Elegant transition library for iOS & tvOS
by chenglou javascript
20656
MIT
A spring that solves your animation problems.
Trending New libraries in Animation
by ManimCommunity python
9720
MIT
A community-maintained Python framework for creating mathematical animations.
by yemount javascript
8018
Apache-2.0
by rough-stuff typescript
5517
MIT
Create and animate hand-drawn annotations on a web page
by gustavoguanabara html
4011
MIT
Curso de HTML5 e CSS3
by boringdesigners javascript
3457
MIT
Boring avatars is a tiny JavaScript React library that generates custom, SVG-based avatars from any username and color palette.
by pystardust shell
3401
GPL-3.0
A cli tool to browse and play anime
by Yqnn typescript
2496
Apache-2.0
Online editor to create and manipulate SVG paths
by nandorojo typescript
2322
🐼 The React Native (+ Web) animation library, powered by Reanimated 2.
by mukul500 kotlin
1869
MIT
An Android app to watch anime on your phone without ads.
Top Authors in Animation
1
103 Libraries
28528
2
27 Libraries
3226
3
25 Libraries
59
4
23 Libraries
1500
5
19 Libraries
445
6
18 Libraries
233
7
17 Libraries
163
8
17 Libraries
403
9
17 Libraries
10211
10
15 Libraries
100
1
103 Libraries
28528
2
27 Libraries
3226
3
25 Libraries
59
4
23 Libraries
1500
5
19 Libraries
445
6
18 Libraries
233
7
17 Libraries
163
8
17 Libraries
403
9
17 Libraries
10211
10
15 Libraries
100
Trending Kits in Animation
We can create any animation with suitable libraries or combinations of libraries in Python that are well-known for their functionalities and functionalities. For developers looking for options with less complex code with maximum customization options, users can customize their plots and designs depending on their preferences.
Choosing a suitable library plays a key role in any machine learning or data science project, and we should do it properly to avoid other related issues which may arise. Some libraries offer an interactive plot to attract playing with the graph and visualize it uniquely. It will allow you to edit videos, create animations, and create a map or geological animations where we can analyze the geological data.
Here is the list of handpicked 18 best Python Animation Libraries in 2023 which will help you with your animation requirements:
manim - 3b1b:
- Is a Python library for creating mathematical animations and educational videos that Grant Sanderson develops.
- Is an open source library that allows users to create high-quality animations which visualize mathematical concepts like animations of graphs, functions, fractals, and more.
- Uses Python code for creating animations which we can export to animated GIFs or video files.
PythonRobotics:
- Is a Python library for implementing different robotics simulations, visualizations, and algorithms.
- Offers various resources and tools for robotics developers, like algorithms for path planning, localization, motion control, mapping, and many more.
- Includes simulation environments like 2D and 3D simulators, that will allow developers to test their algorithms in virtual environments before deploying them on real robots.
matplotlib:
- Is a comprehensive library for creating animated, interactive visualizations and static in Python.
- Produces publication-quality figures in different interactive environments and hardcopy formats across platforms.
- Can be used in Python Scripts, web application servers, various graphical user interface toolkits, and Python/IPython shells.
manim - ManimCommunity:
- Is an animation engine for explanatory math videos used for programmatically creating precise animations.
- Includes various tools for creating animations like support for vector graphics, 3D objects, and complex mathematical equations.
- Also includes features for creating animations with custom fonts, styles, and colors.
plotly.py:
- Is a Python library used to create interactive data visualizations, built on the plotly JavaScript library that allows developers to create various interactive plots.
- Is designed to be easy to use and includes different resources and tools for creating high-quality visualizations.
- Includes support for complex data structures like pandas DataFrames and offers various customization options for fonts, styles, and colors.
seaborn:
- Is a Python data visualization library based on Matplotlib, offering a high-level interface to create attractive and informative statistical graphics.
- Offers various plotting functions for visualizing various data types like continuous data, data distribution, and categorial data.
- Its the ability to create visually appealing plots with minimal effort and supports the customization of plot elements like axes, titles, legends, and labels.
moviepy:
- Is a Python library for video editing, concatenations, cutting, video composting, title insertions, creation of custom effects, and video processing.
- Has the ability to add audio to video clips easily and offers various filters and audio effects like changing pitch and speed, adding sound effects, and adjusting volume.
- Includes support for creating animations like moving text, images, and shapes and allows users to export their video clips to different file formats.
termtosvg:
- Is a Python library that allows users to record terminal sessions and save them as SVG animations.
- Produces clean-looking and lightweight still frames embeddable on the project page or animations.
- Includes support for recording multiple terminal sessions, allowing users to control the size and speed of the resulting animation.
altair:
- Is a declarative statistical visualization library that can help you spend more time understanding your data and its meaning.
- Offers a simple syntax for creating different visualizations, like line charts, histograms, scatterplots, and bar charts.
- Its declarative syntax lets user's express visualizations as a series of high-level mappings between visual and data properties like color, size, and position.
PathPlanning:
- Is a Python library used for path and motion planning applications designed to be accessible to beginners and experts with a straightforward API.
- Offers various algorithms for computing collision-free paths for drones, mobile robots, and manipulators in 2D and 3D environments.
- Also offers tools for trajectory generation, motion control, and obstacle avoidance and supports simulation and visualization of robot motion.
alive-progress:
- Is a Python library for displaying spinners and progress bars in command-line applications designed to offer a customizable way of showing progress indicators for long-running processes or tasks.
- Supports for pausing and resuming progress indicators, nested spinners, and progress bars.
- Designed to be intuitive and simple with various default settings and a straightforward API for customizing the behavior and appearance of spinners and progress bars.
asciimatics:
- Is a package for helping people create full-screen text UIs on any platform and offers a single cross-platform Python class to do all the low-level console functions.
- Includes cursor positioning, mouse input, screen scraping, colored/styled text, detecting and handling if the console resizes, and keyboard input like Unicode support.
- Is a Python library for creating text-based animations and user interfaces in the terminal.
pygal:
- Is a Python library for creating interactive Scalable Vector Graphics (SVG) graphs and charts.
- Offers various tools for generating customizable charts, graphs, and high-quality for use in presentations, reports, and web applications.
- Includes built-in support for data/time axis labeling, responsive design, and integration with web frameworks and interactive charts elements.
GANimation:
- Is a Python implementation of the GANimation research project, which offers various tools for generating animations from still images using Generative Adversarial Networks (GANs).
- Includes tools for augmenting and preprocessing input data, customizable GAN training parameters and architecture, and support for evaluating and visualizing GAN models.
- Offers various tools for fine-tuning GAN models and generating high-quality animations for various applications.
deep-motion-editing:
- Offers advanced and fundamental functions to work with 3D character animations in deep learning with Pytorch.
- Is a Python implementation of the research project of the same name, which offers tools for editing the motion of human characters in video sequences using deep learning methods.
- Its ability to generate realistic, high-quality animations for various applications offers tools for fine-tuning the deep learning model and editing the generated motions to achieve the desired results.
geoplotlib:
- Is a Python library for creating geographical maps and visualizations and offers an easy-to-use interface for creating maps with different data types, like polygons, heatmaps, lines, and points.
- Includes support for different tile providers and map projections, customizable styling options for data layers like size, transparency, and color.
- Designed for creating interactive maps and visualizations and is suitable for various applications like data analysis, presentation, and exploration.
Linux-Fake-Background-Webcam:
- Is a Python library that will allow users to replace their webcam background with a custom video or image on Linux systems.
- Works by creating a virtual webcam device that can be selected as the input source in video conferencing applications, allowing users to appear as if they are in various environments and locations.
- Includes the ability to control the position and size of the custom background video or image and support for replacing the webcam background with a custom video or audio.
celluloid:
- Is a Python library that offers a simple interface for creating visualizations and animations in Matplotlib
- Designed to make it easy for users to create animations without having to write to deal with low-level details and complex code.
- Includes a simple interface for adding and updating data in the animation, the ability to save the animation as an MP4 or GIF video file, and support for customizing the animation style and appearance.
React libraries enable developers to craft fluid user interfaces with reusable, ready UI code components. Creating animations is more convenient with the JavaScript virtual DOM programming model of React as compared to the traditional DOM, which helps in boosting performance. Props-based data binding in React libraries enables better flow, efficient debugging and also helps developers reduce some of the boilerplates. Using React libraries gives a coder a cleaner, more responsive approach to animations since the code is easier to reason about. An open platform React animation library supports full-stack programming, making it a holistic solution for web and app-based animations. Presented below is an updated JavaScript library list for React animation packages. lottie-web - Effects animations natively; react-motion - A spring that solves your animation problems; react-native-animatable - Standard set of easy to use animations.
Matplotlib is a Python data visualization toolkit. It will enable users to construct a variety of visualizations. It will enable visualizations like line plots, scatter plots, bar charts, histograms, and others. It is one of the most used libraries for data visualization in the Python environment. It is used in engineering and scientific applications. Large datasets may be handled and visualized because of Matplotlib's seamless integration.
The capability of Matplotlib to produce interactive visuals is one of its core features. Using the Matplotlib widget library, which offers a variety of interactive widgets. Moreover, it offers a significant degree of customization. It will enable users to edit their visualizations' colors, fonts, axes, labels, and other elements. It will let the users can add interaction and communication to their plots.
For making animated visualizations, Matplotlib's FuncAnimation class is a helpful resource. You must first construct a figure and axis object and plot your initial data before you can use FuncAnimation. The data in your plot is then updated by a function you write. This FuncAnimation function calls at predetermined intervals. It updates the data and provides a string of Artist objects that represent the revised plot. You can refresh the information in your plot at predetermined intervals. It will provide the impression of motion or change over time.
Preview of the output obtained when funcAnimation class is used.
Code
The im object in Matplotlib is an instance of the imshow class that is used to display a 2D array as an image. The data shown in the image is updated for each frame of the animation using the set array method of the im object.
We are instructing FuncAnimation to update only the im object on each frame rather than redrawing the full figure by returning im from the animate function. Especially for large and complicated visualisations, this can lead to greater performance and smoother animations.
The FuncAnimation object, which contains all the data required to produce and control the animation, is returned by the create video function's return anim statement.
Follow the steps carefully to get the output easily.
- Install Visual Studio Code in your computer.
- Install the required library by using the following commands
pip install matplotlib
pip install numpy
- If your system is not reflecting the installation, try running the above command by opening windows powershell as administrator.
- Open the folder in the code editor, copy and paste the above kandi code snippet in the python file.
- Remove the first line of the code.
- Run the code using the run command.
I hope you found this useful. I have added the link to dependent libraries, version information in the following sections.
I found this code snippet by searching for "Create animations in Matplotlib using the FuncAnimation class" in kandi. You can try any such use case!
Dependent Libraries
If you do not have numpy and matplotlib that is required to run this code, you can install it by clicking on the above link and copying the pip Install command from the pages in kandi.
You can search for any dependent library on kandi like matplotlib.
Environment tested
- This code had been tested using python version 3.8.0
- numpy version 1.24.2 has been used.
- matplotlib version 3.7.1 has been used.
Support
- For any support on kandi solution kits, please use the chat
- For further learning resources, visit the Open Weaver Community learning page.
Here are some famous React Animation Bot Libraries. Some of the use cases of React Animation Libraries include Creating custom page transitions, animating user interface elements, animating data visualisations, Animating complex user interfaces.
React animation libraries are JavaScript libraries that provide a set of tools to animate components in a React application. These libraries make it easy to animate various components such as buttons, dropdowns, modals, and other user interface elements. They provide powerful APIs that allow developers to create complex animations with minimal code.
Let us look at the libraries in detail below.
react-spring
- Utilizes physical equations and damping functions to create realistic and natural animations.
- Integrates with any other animation library.
- Highly optimized for performance, making it a great choice for complex animations.
react-native-reanimated
- Support for both imperative and declarative APIs.
- Support for interpolation and value transformations.
- Ability to use native platform-specific animations (e.g., spring animations on iOS).
animated
- Provides a comprehensive and flexible API for declarative and imperative animation control.
- Only library to offer React Native support.
- Allows developers to animate components directly from the React Native bridge.
react-anime
- Modular structure allows developers to create custom animations from individual components.
- Allows developers to create smooth transitions between different states of their animation.
- Offers unique easing functions to create a variety of animation styles.
react-animation
- Supports both CSS and JavaScript animations, making it easy to customize and animate components.
- Offers a wide variety of animations such as sliding, fading, and scaling.
- Allows developers to chain multiple animations together to create complex sequences.
moti
- Advanced features such as timeline-based animation sequencing.
- Supports both native and JavaScript-based animations.
- Includes an extensive library of pre-built animations.
Resonance
- Offers a robust set of tools to customize and manage animations.
- Designed to be performant, meaning that animations run smoothly on all devices.
- Provides an easy way to create complex animations, along with a variety of interpolation methods and easing functions.
react-animation-comparison
- Provides a comprehensive suite of tools and features.
- Powerful animation library and an intuitive GUI.
- Has a built-in timeline and animation editor.
renature
- Lightweight library that is designed to make animations easy to implement.
- It offers a wide range of animation options.
- Provides an animation editor that allows users to generate animations quickly and easily.
Lottie-react
- Completely open-source, allowing developers to customize and extend the library as they see fit.
- Extremely lightweight and fast-loading.
- Declarative API for easily adding complex animations to React components.
Here is a list of the best Swift/iOS animation libraries for 2023 that developers can use to create immersive animations for mobile app development.
Animations can make a huge difference in user experience. Animation Libraries are a great way to add dynamic animations to the app. Correctly implemented, functional, beautiful animations are a joy for users and will help keep them engaged in the app. These libraries cover everything from user interface design to app analytics in a way that makes it very easy to implement animation in projects.
We have curated a list of the ten best Swift/iOS animation libraries that each provide a unique function.
Lottie-web
- Useful in adding animated icons and illustrations.
- Helps load animations.
- Helps in animated backgrounds.
react-motion
- Allows beautiful animations and transitions with a simple syntax.
- Customizes the timing and duration of animations.
- Helps in creating complex animations and transitions with ease.
Hero
- Helpful in custom navigation transitions.
- Helps in creating interactive animations when tapping on views.
- Helps in creating personalized presentation transitions.
SkeletonView
- Represents the structure of the UI.
- Helps in customizing the look of the skeleton screens.
- Creates empty screen animations.
ViewAnimator
- Helps in animating views with ease.
- Allows customizable animations with different directions, delays, and durations.
- Helps in combining multiple animations for complex effects.
SwiftMessages
- Allows custom in-app notifications to come up with animations.
- Allows customizable designs for alerts and banners.
- Shows toast notifications.
LiquidLoader.
- Creates a Fun, liquid-style loading animation.
- Allows customizable animations with different colors and shapes.
- Helps in modifying loading animations for buttons and UI elements.
AnimatedCollectionViewLayout
- Customizes the animation style and direction.
- Helps in supporting different types of cells.
- Creates 3D effects.
LNZCollectionLayouts
- Has custom collection view layouts for unique designs.
- Allows supporting different layout styles, such as circular and spiral.
- Provides dynamic resizing and animation of cells.
Shimmer
- Helpful in table view and collection view loading animations.
- Used for empty screen placeholder animations.
- Mimics the look of reflective surfaces.
Here are some of the Android Animation Libraries. Some of the use cases of Android Animation Libraries include Creating complex UI elements, enhancing user experience, enhancing game development, and Creating app-specific animations.
Android Animation Libraries are collections of code libraries and tools for creating and animating graphics for Android applications. The libraries include a variety of animation techniques, such as keyframing, and physics-based animation, which can be used to create dynamic and interactive visual elements.
Let us look at the libraries in detail below.
rebound
- Uses a spring physics model to create animations.
- Designed to be used with the Android UI toolkit.
- Highly customizable.
lottie-android
- Highly efficient and supports vector-based animations.
- Compatible with both Android and iOS devices.
- Allows you to create complex animations with a few simple lines of code
Android-Animation-Set
- Has no bugs, has no vulnerabilities.
- Has a Permissive License and it has medium support.
- Used in Telecommunications, Media, Telecom, User Interface, Animation applications.
recyclerview-animators
- Uses less memory and fewer resources than other animation libraries.
- Allows you to tweak and customize the animations to suit your needs.
- Has built-in support for a range of animations, including alpha, translate, rotation, and more.
ViewAnimator
- Allows developers to mix and match different animations to create complex effects.
- Has excellent documentation and a wide range of tutorials available.
- Animations created can be reused in multiple activities or applications.
Swirl
- Doesn’t require a lot of setups and is easy to use.
- Provides a wide range of customization options.
- Has a powerful timeline feature that enables developers to animate objects across a timeline in a single line of code.
Animated-icons
- Require less memory than many other animation libraries, making them ideal for mobile applications.
- Have a smaller code base than most other animation libraries.
- Are designed to be responsive, so they will resize and adapt to different screen sizes.
RxAnimation
- Create animations that span multiple platforms, including iOS and Windows.
- Able to create animations that are synchronized with user input.
- Allows developers to create custom animations according to their specific needs.
React is a well-known JavaScript toolkit to generate reusable UI components that may be combined to create intricate and dynamic online apps. JavaScript is a popular programming language for developing interactive and dynamic web experiences. It is the fundamental language of the internet, and all current web browsers support it.
Web apps are frequently created using a combination of React and JavaScript. React uses JavaScript to create and modify the user interface (UI), manage user interactions, and update the React components. Using the strength of React and the adaptability of JavaScript, you can do this to develop rich and interactive online applications. Framer Motion is a popular open-source animation library for React. It offers a straightforward and clear API for developing animations and gesture-based interactions in React and is built on top of the well-known animation library React-Spring.
Framer Motion has several vital features, including natural gesture-based interactions, a simple and declarative API, automatic animations, server-side rendering, and more.
This example shows how easy it is to create a slideshow effect with Framer Motion.
PS: Preview of the output that you will get on running this code from your IDE
Code
In this solution we use the AnimatePresence tag in the react application to achieve it.
- Copy the code using the "Copy" button above, and paste it in a react project in your IDE.
- Run the application to see a timer which runs with a slideshow effect.
Note that any element can be used inside the motion tag, which will be animated.
I found this code snippet by searching for "Slideshow effect" in kandi. You can try any such use case!
Dependent Libraries
If you do not have react application that is required to run this code, you can install it by clicking on the above link of react page in kandi.
You can search for any dependent library on kandi like React.
Environment Tested
I tested this solution in the following versions. Be mindful of changes when working with other versions.
- The solution is created in react v18.2.0 and framer motion v6.2.4
- The solution is tested on chrome browser on codesandbox.io
Support
- For any support on kandi solution kits, please use the chat
- For further learning resources, visit the Open Weaver Community learning page.
Angular Animation Libraries are used for animation-related resources designed for the Angular Framework. Angular Animation Libraries for different processes like Animation Data Visualization and Page Transitions.
These libraries include pre-built animation effects, transitions, and elements. These libraries offer various features for creating engaging and interactive user interfaces. They use a declarative syntax for defining animations, doing reading, and understanding the code easier. Angular animation libraries offer advanced features like SVG, 3D animations, and parallax scrolling. It can be used for creating complex and dynamic user interfaces. It provides interactivity features like click and hover animations. It creates more engagement and interaction.
Here is a list of handpicked top 9 Angular Animation Libraries of 2023 for your reference:
tsparticles:
- Is a lightweight JavaScript library that we can use to create particle animations.
- Offers an effortless way for adding particle effects to web applications with a focus on flexibility and performance.
- Allows customization the particle animations like particle shape, size, density, speed, and color.
- Making it easy to create a unique and visually appealing particle effect that matches the design and UI goals.
rxviz:
- Is a web-based reactive programming framework that visualizes the behavior of RxJS Observables.
- Is a popular library for reactive programming in JavaScript and is used in Angular applications.
- Offers a graphical representation of Observable streams to visualize how data flows through the application.
- Making it easy to identify issues and optimize the application behavior.
angular-scroll:
- Is an Angular library that offers smooth scrolling animations for web applications.
- Allows developers to create scrolling animations that smoothly transition between different application sections.
- Offers an effortless way to create anchor links that scroll to a specific application section
- Allows users to navigate to various sections without manually scrolling through the content.
- Can create smooth scrolling animations to enhance web applications' visual appeal and UI.
angularjs-slider:
- Is a library that offers a customizable range slider for AngularJS applications.
- Allows developers to create range sliders.
- Allow users to select a range of values within a defined set, like choosing a range of prices or dates.
- Offers a range of customization options that will help developers fine-tune their slider to match the design and UI goals.
ngAnimate:
- Is a built-in Angular library that offers support for animations in Angular applications.
- Allows developers to create animations by changing the application state.
- Is built into Angular, which makes it easy to add animations to existing applications.
- Create a new application with built-in animation features.
delighters:
- Is an Angular library that offers a straightforward way to add subtle and engaging animations to web pages.
- Allows developers to create animations triggered as the user scrolls through the page.
- Offering a more dynamic and engaging UI.
- Is a lightweight library that has minimal impact on the overall performance of the web application.
angular-svg-round-progressbar:
- Is an Angular library that offers a circular, customizable progress bar using SVG graphics.
- Allows developers to create circular progress, which shows the progress of an ongoing process.
- Offering a visual cue for users of the application status.
- Offers various options to fine-tune the progress bar to match the application's design and user experience goals.
ngx-spinner:
- Allows developers to customize the loading spinners with diverse options like size, style, and color.
- Making it easier to create loading spinners that match the design and UI goals.
- Can be integrated with different web technologies like React, vanilla JavaScript, and Angular.
- Making it easier to add loading spinners to the current web applications or create new ones.
- Is designed to be accessible with support for screen readers and keyboard navigation.
- Ensuring users can navigate and interact with the application.
angular-spinner:
- Is an Angular library that provides an effortless way to add loading spinners for web applications.
- Allows developers to create loading spinners that appear if data is fetched or processed.
- Providing a visual cue to users which application is working.
- Offers multiple spinner types, like spinner dots and lines.
- Allowing developers to choose the spinner type that best fits the application's design and user interface goals.
Python visualization and animation libraries are modules or packages that allow you to create animations, charts, and other graphics using Python code. They usually provide functions or classes that help you manipulate graphical elements such as shapes, colors, images, text, etc., and control their movement, appearance, and behavior over time. Some examples of Python animation libraries are Matplotlib, VPython, and manim.
Python animation libraries are useful for creating dynamic and interactive visualizations of data or objects using Python code. For example, you can use Matplotlib to plot graphs of functions or figures and add animations to them. You can also use VPython to create 3D displays and animations of physical phenomena. Another example is manim, an animation library designed for an intuitive and easy-to-use interface and for explanatory math videos used for programmatically creating precise animations.
Python itself cannot create animation. It can only create images. It needs an external program to create a perception of movement. Python animation libraries may have specific requirements or caveats for creating animations. For example, celluloid requires that the axes limits are the same for all plots and that artists are passed to the legend function separately Plotly has some limitations with 3D animations and interactivity.
Here are some of the top open source Python animation libraries you can leverage in your projects.
Animation is the craft of making inanimate objects appear to move. It is a method by which still figures are manipulated to appear as moving images.
Pygame is a Python module set designed for composing video games. It is written on top of the perfect SDL library. This will allow you to create fully featured multimedia programs and games in Python. Pygame is highly portable and will run on nearly every platform and operating system.
- There are different ways to create animations in Pygame, such as sprites and character animation.
Here is an example of creating and displaying simple animations in Pygame.
Fig1: Preview of the Code
Fig2: Preview of Output when the code is run in IDE.
Code
In this solution, we are creating and displaying simple animations using Pygame
Instructions
Follow the steps carefully to get the output easily.
- Install Jupyter Notebook on your computer.
- Open terminal and install the required libraries with following commands.
- Install pygame - pip install pygame.
- Copy the code using the "Copy" button above, and paste it into your IDE's Python file.
- Run the file to get the desired output.
I hope you found this useful. I have added the link to dependent libraries, version information in the following sections.
I found this code snippet by searching for "Text animations in pygame" in kandi. You can try any such use case!
Dependent Libraries
If you do not have Pygame that is required to run this code, you can install it by clicking on the above link and copying the pip Install command from the Pygame page in kandi.
You can search for any dependent library on kandi like pygame.
Environment Tested
I tested this solution in the following versions. Be mindful of changes when working with other versions.
- The solution is created in Python 3.9.6
- The solution is tested on pygame version 2.3.0
Using this solution, we are able to create and display simple animations using Pygame.
Support
- For any support on kandi solution kits, please use the chat
- For further learning resources, visit the Open Weaver Community learning page.
Animation Is Continuous and Have smooth Flow By DEVELOVERS
EXAMPLE Of Demo
Create Folder In Root Directory Name As :- Components
1) Name Below Given File As :- BackgroundAnimation.js And Save It in Within Components Folder
import React, { useEffect,useRef } from 'react'; import { Animated, Easing, ImageBackground } from 'react-native'; import backgroundImage from '../res/Background.jpg' import styles from './styles'; import { INPUT_RANGE_START, INPUT_RANGE_END, OUTPUT_RANGE_START, OUTPUT_RANGE_END, ANIMATION_TO_VALUE, ANIMATION_DURATION, } from './constants'; export default function BackgroundAnimation() { const initialValue = 0; const translateValue = useRef(new Animated.Value(initialValue)).current; useEffect(() => { const translate = () => { translateValue.setValue(initialValue); Animated.timing(translateValue, { toValue: ANIMATION_TO_VALUE, duration: ANIMATION_DURATION, easing: Easing.linear, useNativeDriver: true, }).start(() => translate()); }; translate(); }, [translateValue]); const translateAnimation = translateValue.interpolate({ inputRange: [INPUT_RANGE_START, INPUT_RANGE_END], outputRange: [OUTPUT_RANGE_START, OUTPUT_RANGE_END], }); const AnimetedImage = Animated.createAnimatedComponent(ImageBackground); return ( <AnimetedImage resizeMode="repeat" style={[styles.background,{ transform: [ { translateX: translateAnimation, }, { translateY: translateAnimation, }, ], }]} source={backgroundImage} /> ) }
2) Name Below Given File As :- styles.js , And Save It in Within Components Folder
import {StyleSheet} from 'react-native' const styles = StyleSheet.create({ background: { position: 'absolute', width: 1200, height: 1200, top: 0, // Set Fadeness On Image Using Prop Given below opacity: 0.15, transform: [ { translateX: 0, }, { translateY: 0, }, ], }, }); export default styles
3) Name Below Given File As :- constants.js , And Save It in Within Components Folder
export const INPUT_RANGE_START = 0; export const INPUT_RANGE_END = 1; export const OUTPUT_RANGE_START = -281; export const OUTPUT_RANGE_END = 0; export const ANIMATION_TO_VALUE = 1; export const ANIMATION_DURATION = 25000;
Save Image To Directory Named as res Available In Root Directory
Name You Image Background.jpg
../res/Background.jpg
IMAGE SIZE :
4) When You are done With All 3 Files, Now You Just Need To Import It And Call Within That Page
Let's Have A Look on An Example
I am Gonna set It for Login Screen Background:
import React, { useCallback, useEffect, useState } from "react"; import {StatusBar, View, Text, TextInput, Image,StyleSheet, TouchableOpacity, Alert, ActivityIndicator, Keyboard } from "react-native"; import { validate } from "react-email-validator"; import auth from '@react-native-firebase/auth'; // Import The Given Below File import BackgroundAnimation from '../Components/BackgroundAnimation'; const Login = ({route , navigation}) => { return( // this Should Must be Flex 1 And NO Background color or background Image Props <View style={{flex:1}}> <StatusBar backgroundColor="#0a2e2c"/> {/* This Is the Point Where You Should Call That, As Mentioned */} <BackgroundAnimation/> <View style={styles.CentreLogo}>
If This Finds You help Full
Have you ever wanted to be represented by an avatar in virtual reality? Are you looking to make a game or app that uses avatars in Javascript, Typescript, or PHP? Avatars are digital representations of people, pets, or entities. They're widely used in VR games and apps, and they're also becoming popular in the Metaverse—a unified digital space where people can meet, interact, and create things together. Avatar technology has been around for a long time—it's not new. But with the increasing popularity of the Metaverse, it is becoming more popular than ever. There are many different ways to use avatars. They can be used for all types of virtual experiences, including games and education apps. For example, you could create a game where you have to find your way through a maze using an avatar. Or, you could create an educational app where you have to find your way through a maze using an avatar. In the Metaverse and in VR gaming, avatars are more than just characters—they're extensions of ourselves. Many people jump into both the physical and virtual world wearing their best heels. Some gamers wear full-body suits to help them truly embody their avatars. Most avatars are animated by code—here are some popular open-source libraries you can use to create and use avatars.
Trending Discussions on Animation
AngularFireModule and AngularFireDatabaseModule not being found in @angular/fire
Marquee Text Effect in Jetpack Compose
android:exported added but still getting error Apps targeting Android 12 and higher are required to specify an explicit value for android:exported
Error importing Framer Motion v5 in React (with create-react-app)
Android Build Error: "lStar not found..."
Make ModalBottomSheetLayout always Expanded
Project update recommended: Android Gradle Plugin can be upgraded. Error message: Can not find AGP version in build files
Angular TSLint - Cannot find builder "@angular-devkit/build-angular:tslint"
SVG stop running chained animation (<animate> tag)
How to replace deprecated .animation() in SwiftUI?
QUESTION
AngularFireModule and AngularFireDatabaseModule not being found in @angular/fire
Asked 2022-Apr-01 at 12:56I am trying to implement Firebase Realtime Database into a angular project and Im getting stuck at one of the very first steps. Importing AngularFireModule and AngularFireDatabaseModule. It gives me the following error:
1Module '"@angular/fire"' has no exported member 'AngularFireModule'.ts(2305)
2
1Module '"@angular/fire"' has no exported member 'AngularFireModule'.ts(2305)
2Module '"@angular/fire/database"' has no exported member 'AngularFireDatabaseModule'.
3
And here is how I am importing them:
1Module '"@angular/fire"' has no exported member 'AngularFireModule'.ts(2305)
2Module '"@angular/fire/database"' has no exported member 'AngularFireDatabaseModule'.
3import {AngularFireModule } from '@angular/fire';
4import {AngularFireDatabaseModule} from '@angular/fire/database'
5
Am I missing something here? I have installed @angular/fire via the command
1Module '"@angular/fire"' has no exported member 'AngularFireModule'.ts(2305)
2Module '"@angular/fire/database"' has no exported member 'AngularFireDatabaseModule'.
3import {AngularFireModule } from '@angular/fire';
4import {AngularFireDatabaseModule} from '@angular/fire/database'
5npm i firebase @angular/fire
6
and have also installed firebase tools. Here is a list of the Angular packages I currently have installed and their versions:
1Module '"@angular/fire"' has no exported member 'AngularFireModule'.ts(2305)
2Module '"@angular/fire/database"' has no exported member 'AngularFireDatabaseModule'.
3import {AngularFireModule } from '@angular/fire';
4import {AngularFireDatabaseModule} from '@angular/fire/database'
5npm i firebase @angular/fire
6Angular CLI: 12.2.2
7Node: 14.17.4
8Package Manager: npm 6.14.14
9OS: win32 x64
10
11Angular: 12.2.3
12... animations, common, compiler, compiler-cli, core, forms
13... platform-browser, platform-browser-dynamic, router
14
15Package Version
16---------------------------------------------------------
17@angular-devkit/architect 0.1202.2
18@angular-devkit/build-angular 12.2.2
19@angular-devkit/core 12.2.2
20@angular-devkit/schematics 12.2.2
21@angular/cli 12.2.2
22@angular/fire 7.0.0
23@schematics/angular 12.2.2
24rxjs 6.6.7
25typescript 4.3.5
26
I do apologise if this is all excessive information but I am completely stuck as to what the issue is. Any help would be GREATLY appreciated. Right now my suspicion is that its a compatibility issue or perhaps a feature that doesnt exist anymore on the latest versions but I really dont know.
ANSWER
Answered 2021-Aug-26 at 13:20AngularFire 7.0.0 was launched yesterday with a new API that has a lot of bundle size reduction benefits.
Instead of top level classes like AngularFireDatabase
, you can now import smaller independent functions.
1Module '"@angular/fire"' has no exported member 'AngularFireModule'.ts(2305)
2Module '"@angular/fire/database"' has no exported member 'AngularFireDatabaseModule'.
3import {AngularFireModule } from '@angular/fire';
4import {AngularFireDatabaseModule} from '@angular/fire/database'
5npm i firebase @angular/fire
6Angular CLI: 12.2.2
7Node: 14.17.4
8Package Manager: npm 6.14.14
9OS: win32 x64
10
11Angular: 12.2.3
12... animations, common, compiler, compiler-cli, core, forms
13... platform-browser, platform-browser-dynamic, router
14
15Package Version
16---------------------------------------------------------
17@angular-devkit/architect 0.1202.2
18@angular-devkit/build-angular 12.2.2
19@angular-devkit/core 12.2.2
20@angular-devkit/schematics 12.2.2
21@angular/cli 12.2.2
22@angular/fire 7.0.0
23@schematics/angular 12.2.2
24rxjs 6.6.7
25typescript 4.3.5
26import { list } from '@angular/fire/database';
27
The initialization process is a bit different too as it has a more flexible API for specifying configurations.
1Module '"@angular/fire"' has no exported member 'AngularFireModule'.ts(2305)
2Module '"@angular/fire/database"' has no exported member 'AngularFireDatabaseModule'.
3import {AngularFireModule } from '@angular/fire';
4import {AngularFireDatabaseModule} from '@angular/fire/database'
5npm i firebase @angular/fire
6Angular CLI: 12.2.2
7Node: 14.17.4
8Package Manager: npm 6.14.14
9OS: win32 x64
10
11Angular: 12.2.3
12... animations, common, compiler, compiler-cli, core, forms
13... platform-browser, platform-browser-dynamic, router
14
15Package Version
16---------------------------------------------------------
17@angular-devkit/architect 0.1202.2
18@angular-devkit/build-angular 12.2.2
19@angular-devkit/core 12.2.2
20@angular-devkit/schematics 12.2.2
21@angular/cli 12.2.2
22@angular/fire 7.0.0
23@schematics/angular 12.2.2
24rxjs 6.6.7
25typescript 4.3.5
26import { list } from '@angular/fire/database';
27@NgModule({
28 imports: [
29 provideFirebaseApp(() => initializeApp(config)),
30 provideFirestore(() => {
31 const firestore = getFirestore();
32 connectEmulator(firestore, 'localhost', 8080);
33 enableIndexedDbPersistence(firestore);
34 return firestore;
35 }),
36 provideStorage(() => getStorage()),
37 ],
38})
39
If you want to proceed with the older API there's a compatibility layer.
1Module '"@angular/fire"' has no exported member 'AngularFireModule'.ts(2305)
2Module '"@angular/fire/database"' has no exported member 'AngularFireDatabaseModule'.
3import {AngularFireModule } from '@angular/fire';
4import {AngularFireDatabaseModule} from '@angular/fire/database'
5npm i firebase @angular/fire
6Angular CLI: 12.2.2
7Node: 14.17.4
8Package Manager: npm 6.14.14
9OS: win32 x64
10
11Angular: 12.2.3
12... animations, common, compiler, compiler-cli, core, forms
13... platform-browser, platform-browser-dynamic, router
14
15Package Version
16---------------------------------------------------------
17@angular-devkit/architect 0.1202.2
18@angular-devkit/build-angular 12.2.2
19@angular-devkit/core 12.2.2
20@angular-devkit/schematics 12.2.2
21@angular/cli 12.2.2
22@angular/fire 7.0.0
23@schematics/angular 12.2.2
24rxjs 6.6.7
25typescript 4.3.5
26import { list } from '@angular/fire/database';
27@NgModule({
28 imports: [
29 provideFirebaseApp(() => initializeApp(config)),
30 provideFirestore(() => {
31 const firestore = getFirestore();
32 connectEmulator(firestore, 'localhost', 8080);
33 enableIndexedDbPersistence(firestore);
34 return firestore;
35 }),
36 provideStorage(() => getStorage()),
37 ],
38})
39import { AngularFireModule} from '@angular/fire/compat'
40import { AngularFireDatabaseModule } from '@angular/fire/compat/database';
41
QUESTION
Marquee Text Effect in Jetpack Compose
Asked 2022-Mar-30 at 10:05In the past, a kind of animation could be included in the text, in which if the text exceeded the limits, it would automatically scroll horizontally. This was done by including: android:ellipsize="marquee"
, and the result was something similar to the one shown here:
The problem is that in Jetpack Compose I don't see a way to include that option inside the Composable Text, there is the TextOverflow
that includes the Clip, Ellipsis or Visible options, but I don't know if there is a way to include or use the "Marquee" option in Jetpack Compose. Is there any way to do it?
ANSWER
Answered 2022-Mar-30 at 10:05This is not yet supported by Compose, but it's not too hard to implement. You will need TargetBasedAnimation
, which will update the text offset, and SubcomposeLayout
, which lies under most collections. Inside you can define the size of the text, and also place the second similar Text
, which will appear from the right edge.
1@Composable
2fun MarqueeText(
3 text: String,
4 modifier: Modifier = Modifier,
5 textModifier: Modifier = Modifier,
6 gradientEdgeColor: Color = Color.White,
7 color: Color = Color.Unspecified,
8 fontSize: TextUnit = TextUnit.Unspecified,
9 fontStyle: FontStyle? = null,
10 fontWeight: FontWeight? = null,
11 fontFamily: FontFamily? = null,
12 letterSpacing: TextUnit = TextUnit.Unspecified,
13 textDecoration: TextDecoration? = null,
14 textAlign: TextAlign? = null,
15 lineHeight: TextUnit = TextUnit.Unspecified,
16 overflow: TextOverflow = TextOverflow.Clip,
17 softWrap: Boolean = true,
18 onTextLayout: (TextLayoutResult) -> Unit = {},
19 style: TextStyle = LocalTextStyle.current,
20) {
21 val createText = @Composable { localModifier: Modifier ->
22 Text(
23 text,
24 textAlign = textAlign,
25 modifier = localModifier,
26 color = color,
27 fontSize = fontSize,
28 fontStyle = fontStyle,
29 fontWeight = fontWeight,
30 fontFamily = fontFamily,
31 letterSpacing = letterSpacing,
32 textDecoration = textDecoration,
33 lineHeight = lineHeight,
34 overflow = overflow,
35 softWrap = softWrap,
36 maxLines = 1,
37 onTextLayout = onTextLayout,
38 style = style,
39 )
40 }
41 var offset by remember { mutableStateOf(0) }
42 val textLayoutInfoState = remember { mutableStateOf<TextLayoutInfo?>(null) }
43 LaunchedEffect(textLayoutInfoState.value) {
44 val textLayoutInfo = textLayoutInfoState.value ?: return@LaunchedEffect
45 if (textLayoutInfo.textWidth <= textLayoutInfo.containerWidth) return@LaunchedEffect
46 val duration = 7500 * textLayoutInfo.textWidth / textLayoutInfo.containerWidth
47 val delay = 1000L
48
49 do {
50 val animation = TargetBasedAnimation(
51 animationSpec = infiniteRepeatable(
52 animation = tween(
53 durationMillis = duration,
54 delayMillis = 1000,
55 easing = LinearEasing,
56 ),
57 repeatMode = RepeatMode.Restart
58 ),
59 typeConverter = Int.VectorConverter,
60 initialValue = 0,
61 targetValue = -textLayoutInfo.textWidth
62 )
63 val startTime = withFrameNanos { it }
64 do {
65 val playTime = withFrameNanos { it } - startTime
66 offset = (animation.getValueFromNanos(playTime))
67 } while (!animation.isFinishedFromNanos(playTime))
68 delay(delay)
69 } while (true)
70 }
71
72 SubcomposeLayout(
73 modifier = modifier.clipToBounds()
74 ) { constraints ->
75 val infiniteWidthConstraints = constraints.copy(maxWidth = Int.MAX_VALUE)
76 var mainText = subcompose(MarqueeLayers.MainText) {
77 createText(textModifier)
78 }.first().measure(infiniteWidthConstraints)
79
80 var gradient: Placeable? = null
81
82 var secondPlaceableWithOffset: Pair<Placeable, Int>? = null
83 if (mainText.width <= constraints.maxWidth) {
84 mainText = subcompose(MarqueeLayers.SecondaryText) {
85 createText(textModifier.fillMaxWidth())
86 }.first().measure(constraints)
87 textLayoutInfoState.value = null
88 } else {
89 val spacing = constraints.maxWidth * 2 / 3
90 textLayoutInfoState.value = TextLayoutInfo(
91 textWidth = mainText.width + spacing,
92 containerWidth = constraints.maxWidth
93 )
94 val secondTextOffset = mainText.width + offset + spacing
95 val secondTextSpace = constraints.maxWidth - secondTextOffset
96 if (secondTextSpace > 0) {
97 secondPlaceableWithOffset = subcompose(MarqueeLayers.SecondaryText) {
98 createText(textModifier)
99 }.first().measure(infiniteWidthConstraints) to secondTextOffset
100 }
101 gradient = subcompose(MarqueeLayers.EdgesGradient) {
102 Row {
103 GradientEdge(gradientEdgeColor, Color.Transparent)
104 Spacer(Modifier.weight(1f))
105 GradientEdge(Color.Transparent, gradientEdgeColor)
106 }
107 }.first().measure(constraints.copy(maxHeight = mainText.height))
108 }
109
110 layout(
111 width = constraints.maxWidth,
112 height = mainText.height
113 ) {
114 mainText.place(offset, 0)
115 secondPlaceableWithOffset?.let {
116 it.first.place(it.second, 0)
117 }
118 gradient?.place(0, 0)
119 }
120 }
121}
122
123@Composable
124private fun GradientEdge(
125 startColor: Color, endColor: Color,
126) {
127 Box(
128 modifier = Modifier
129 .width(10.dp)
130 .fillMaxHeight()
131 .background(
132 brush = Brush.horizontalGradient(
133 0f to startColor, 1f to endColor,
134 )
135 )
136 )
137}
138
139private enum class MarqueeLayers { MainText, SecondaryText, EdgesGradient }
140private data class TextLayoutInfo(val textWidth: Int, val containerWidth: Int)
141
Usage:
1@Composable
2fun MarqueeText(
3 text: String,
4 modifier: Modifier = Modifier,
5 textModifier: Modifier = Modifier,
6 gradientEdgeColor: Color = Color.White,
7 color: Color = Color.Unspecified,
8 fontSize: TextUnit = TextUnit.Unspecified,
9 fontStyle: FontStyle? = null,
10 fontWeight: FontWeight? = null,
11 fontFamily: FontFamily? = null,
12 letterSpacing: TextUnit = TextUnit.Unspecified,
13 textDecoration: TextDecoration? = null,
14 textAlign: TextAlign? = null,
15 lineHeight: TextUnit = TextUnit.Unspecified,
16 overflow: TextOverflow = TextOverflow.Clip,
17 softWrap: Boolean = true,
18 onTextLayout: (TextLayoutResult) -> Unit = {},
19 style: TextStyle = LocalTextStyle.current,
20) {
21 val createText = @Composable { localModifier: Modifier ->
22 Text(
23 text,
24 textAlign = textAlign,
25 modifier = localModifier,
26 color = color,
27 fontSize = fontSize,
28 fontStyle = fontStyle,
29 fontWeight = fontWeight,
30 fontFamily = fontFamily,
31 letterSpacing = letterSpacing,
32 textDecoration = textDecoration,
33 lineHeight = lineHeight,
34 overflow = overflow,
35 softWrap = softWrap,
36 maxLines = 1,
37 onTextLayout = onTextLayout,
38 style = style,
39 )
40 }
41 var offset by remember { mutableStateOf(0) }
42 val textLayoutInfoState = remember { mutableStateOf<TextLayoutInfo?>(null) }
43 LaunchedEffect(textLayoutInfoState.value) {
44 val textLayoutInfo = textLayoutInfoState.value ?: return@LaunchedEffect
45 if (textLayoutInfo.textWidth <= textLayoutInfo.containerWidth) return@LaunchedEffect
46 val duration = 7500 * textLayoutInfo.textWidth / textLayoutInfo.containerWidth
47 val delay = 1000L
48
49 do {
50 val animation = TargetBasedAnimation(
51 animationSpec = infiniteRepeatable(
52 animation = tween(
53 durationMillis = duration,
54 delayMillis = 1000,
55 easing = LinearEasing,
56 ),
57 repeatMode = RepeatMode.Restart
58 ),
59 typeConverter = Int.VectorConverter,
60 initialValue = 0,
61 targetValue = -textLayoutInfo.textWidth
62 )
63 val startTime = withFrameNanos { it }
64 do {
65 val playTime = withFrameNanos { it } - startTime
66 offset = (animation.getValueFromNanos(playTime))
67 } while (!animation.isFinishedFromNanos(playTime))
68 delay(delay)
69 } while (true)
70 }
71
72 SubcomposeLayout(
73 modifier = modifier.clipToBounds()
74 ) { constraints ->
75 val infiniteWidthConstraints = constraints.copy(maxWidth = Int.MAX_VALUE)
76 var mainText = subcompose(MarqueeLayers.MainText) {
77 createText(textModifier)
78 }.first().measure(infiniteWidthConstraints)
79
80 var gradient: Placeable? = null
81
82 var secondPlaceableWithOffset: Pair<Placeable, Int>? = null
83 if (mainText.width <= constraints.maxWidth) {
84 mainText = subcompose(MarqueeLayers.SecondaryText) {
85 createText(textModifier.fillMaxWidth())
86 }.first().measure(constraints)
87 textLayoutInfoState.value = null
88 } else {
89 val spacing = constraints.maxWidth * 2 / 3
90 textLayoutInfoState.value = TextLayoutInfo(
91 textWidth = mainText.width + spacing,
92 containerWidth = constraints.maxWidth
93 )
94 val secondTextOffset = mainText.width + offset + spacing
95 val secondTextSpace = constraints.maxWidth - secondTextOffset
96 if (secondTextSpace > 0) {
97 secondPlaceableWithOffset = subcompose(MarqueeLayers.SecondaryText) {
98 createText(textModifier)
99 }.first().measure(infiniteWidthConstraints) to secondTextOffset
100 }
101 gradient = subcompose(MarqueeLayers.EdgesGradient) {
102 Row {
103 GradientEdge(gradientEdgeColor, Color.Transparent)
104 Spacer(Modifier.weight(1f))
105 GradientEdge(Color.Transparent, gradientEdgeColor)
106 }
107 }.first().measure(constraints.copy(maxHeight = mainText.height))
108 }
109
110 layout(
111 width = constraints.maxWidth,
112 height = mainText.height
113 ) {
114 mainText.place(offset, 0)
115 secondPlaceableWithOffset?.let {
116 it.first.place(it.second, 0)
117 }
118 gradient?.place(0, 0)
119 }
120 }
121}
122
123@Composable
124private fun GradientEdge(
125 startColor: Color, endColor: Color,
126) {
127 Box(
128 modifier = Modifier
129 .width(10.dp)
130 .fillMaxHeight()
131 .background(
132 brush = Brush.horizontalGradient(
133 0f to startColor, 1f to endColor,
134 )
135 )
136 )
137}
138
139private enum class MarqueeLayers { MainText, SecondaryText, EdgesGradient }
140private data class TextLayoutInfo(val textWidth: Int, val containerWidth: Int)
141MarqueeText("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt")
142
Result:
QUESTION
android:exported added but still getting error Apps targeting Android 12 and higher are required to specify an explicit value for android:exported
Asked 2022-Mar-24 at 15:30I have added android:exported="true"
to my only activity in manifest but still getting below error after updating compile sdk and target sdk version to 31.I also tried rebuilding the project , invalidating cache and restart but that didn't helped
Error- 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.
1<?xml version="1.0" encoding="utf-8"?>
2<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3 package="com.xyz.abc">
4
5 <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
6 <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
7
8 <application
9 android:name=".framework.presentation.BaseApplication"
10 android:allowBackup="true"
11 android:icon="@mipmap/ic_launcher"
12 android:label="@string/app_name"
13 android:roundIcon="@mipmap/ic_launcher_round"
14 android:supportsRtl="true"
15 android:theme="@style/AppTheme">
16 <activity android:name="com.xyz.presentation.MainActivity"
17 android:exported="true">
18 <intent-filter>
19 <action android:name="android.intent.action.MAIN" />
20
21 <category android:name="android.intent.category.LAUNCHER" />
22 </intent-filter>
23 </activity>
24 </application>
25
26</manifest>
27
Other Manifest Files (Included in merge, but did not contribute any elements) firebase-installations:17.0.0 manifest, versionedparcelable:1.1.1 manifest, runtime:1.0.1 manifest, test:core:1.2.0 manifest, loader:1.0.0 manifest, facebook-share:11.1.0 manifest, leakcanary:leaksentry:2.0-alpha-3 manifest, material-dialogs:input:3.2.1 manifest, material-icons-extended:1.0.0 manifest, play-services-stats:17.0.0 manifest, interpolator:1.0.0 manifest, activity-compose:1.3.1 manifest, material-ripple:1.0.0 manifest, foundation:1.0.0 manifest, asynclayoutinflater:1.0.0 manifest, savedstate-ktx:1.1.0 manifest, navigation-dynamic-features-fragment:2.3.5 manifest, firebase-ui-auth:7.2.0 manifest, animation:1.0.1 manifest, animation-core:1.0.1 manifest, installreferrer:1.0 manifest, firebase-crashlytics:18.0.0 manifest, ui:1.0.1 manifest, lifecycle-viewmodel-savedstate:2.3.1 manifest, play-services-auth-base:17.0.0 manifest, hilt-android:2.35.1 manifest, material-dialogs:core:3.2.1 manifest, AndroidManifest.xml navigation file, savedstate:1.1.0 manifest, cursoradapter:1.0.0 manifest, sqlite-framework:2.0.1 manifest, room-ktx:2.1.0 manifest, leakcanary-android-core:2.0-alpha-3 manifest, AndroidManifest.xml navigation file, media:1.0.0 manifest, coordinatorlayout:1.1.0 manifest, legacy-support-core-utils:1.0.0 manifest, lifecycle-runtime:2.3.1 manifest, coil-kt:coil:1.3.1 manifest, ui-tooling-preview:1.0.0 manifest, facebook-core:11.1.0 manifest, core:1.6.0 manifest, material:1.0.0 manifest, firebase-common:20.0.0 manifest, documentfile:1.0.0 manifest, lifecycle-viewmodel-compose:2.4.0-beta01 manifest, play-services-base:17.1.0 manifest, ui-tooling-data:1.0.0 manifest, coil-base:1.3.1 manifest, firebase-analytics-ktx:19.0.0 manifest, localbroadcastmanager:1.0.0 manifest, swiperefreshlayout:1.1.0-alpha03 manifest, constraintlayout-compose:1.0.0-beta02 manifest, core-ktx:1.6.0 manifest, firebase-database-collection:18.0.0 manifest, coil-compose-base:1.3.1 manifest, activity:1.3.1 manifest, AndroidManifest.xml navigation file, facebook-messenger:11.1.0 manifest, print:1.0.0 manifest, customview:1.1.0 manifest, material-icons-core:1.0.0 manifest, play-services-measurement-sdk:19.0.0 manifest, fragment:1.3.4 manifest, firebase-appcheck-interop:16.0.0-beta01 manifest, facebook-login:11.1.0 manifest, cardview:1.0.0 manifest, runtime-rxjava2:1.0.0 manifest, viewpager2:1.0.0 manifest, play-services-ads-identifier:17.0.0 manifest, play-services-measurement-impl:19.0.0 manifest, lifecycle-livedata-core:2.3.1 manifest, play-services-safetynet:17.0.0 manifest, AndroidManifest.xml navigation file, lifecycle-viewmodel-ktx:2.3.1 manifest, transport-backend-cct:3.0.0 manifest, fragment-ktx:1.2.4 manifest, appcompat:1.3.0 manifest, transport-runtime:3.0.0 manifest, lifecycle-livedata-core-ktx:2.2.0 manifest, firebase-firestore-ktx:23.0.0 manifest, legacy-support-v4:1.0.0 manifest, play-services-basement:17.1.1 manifest, firebase-storage:20.0.0 manifest, play-services-auth-api-phone:17.4.0 manifest, leakcanary-android:2.0-alpha-3 manifest, firebase-auth-interop:20.0.0 manifest, lifecycle-viewmodel:2.3.1 manifest, browser:1.0.0 manifest, firebase-auth:21.0.1 manifest, material:1.2.1 manifest, slidingpanelayout:1.0.0 manifest, vectordrawable:1.1.0 manifest, recyclerview:1.1.0 manifest, play-services-auth:19.0.0 manifest, room-runtime:2.1.0 manifest, dagger-lint-aar:2.35.1 manifest, navigation-dynamic-features-runtime:2.3.5 manifest, play-services-measurement-api:19.0.0 manifest, firebase-encoders-json:18.0.0 manifest, sqlite:2.0.1 manifest, facebook-android-sdk:11.1.0 manifest, firebase-components:17.0.0 manifest, transport-api:3.0.0 manifest, protolite-well-known-types:18.0.0 manifest, markdown-processor:0.1.3 manifest, play-services-measurement-base:19.0.0 manifest, firebase-common-ktx:20.0.0 manifest, activity-ktx:1.3.1 manifest, firebase-crashlytics-ktx:18.0.0 manifest, coil-compose:1.3.1 manifest, multidex:2.0.1 manifest, core-runtime:2.1.0 manifest, fragment-testing:1.2.0 manifest, ui-graphics:1.0.1 manifest, AndroidManifest.xml navigation file, ui-tooling:1.0.0 manifest, grpc-android:1.28.0 manifest, ui-unit:1.0.1 manifest, play-services-measurement:19.0.0 manifest, play:core:1.9.1 manifest, annotation-experimental:1.1.0 manifest, play-services-measurement-sdk-api:19.0.0 manifest, play-services-tasks:17.0.0 manifest, firebase-analytics:19.0.0 manifest, facebook-common:11.1.0 manifest, drawerlayout:1.1.1 manifest, AndroidManifest.xml navigation file, navigation-compose:2.4.0-alpha09 manifest, facebook-gamingservices:11.1.0 manifest, firebase-firestore:23.0.0 manifest, lifecycle-livedata:2.2.0 manifest, legacy-support-core-ui:1.0.0 manifest, test:monitor:1.2.0 manifest, AndroidManifest.xml navigation file, facebook-applinks:11.1.0 manifest, viewpager:1.0.0 manifest, ui-geometry:1.0.1 manifest, lifecycle-runtime-ktx:2.3.1 manifest, constraintlayout:2.0.4 manifest, ui-text:1.0.1 manifest, AndroidManifest.xml navigation file, firebase-installations-interop:17.0.0 manifest, transition:1.3.0 manifest, foundation-layout:1.0.1 manifest, appcompat-resources:1.3.1 manifest, runtime-livedata:1.0.0 manifest, runtime-saveable:1.0.1 manifest, firebase-measurement-connector:19.0.0 manifest, vectordrawable-animated:1.1.0 manifest, main nav_graph.xml navigation file 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. Dairy.app main manifest (this file) Error: android:exported needs to be explicitly specified for . Apps targeting Android 12 and higher are required to specify an explicit value forandroid:exported
when the corresponding component has an intent filter defined. See https://developer.android.com/guide/topics/manifest/activity-element#exported for details. Dairy.app main manifest (this file) Error: android:exported needs to be explicitly specified for . Apps targeting Android 12 and higher are required to specify an explicit value forandroid:exported
when the corresponding component has an intent filter defined. See https://developer.android.com/guide/topics/manifest/activity-element#exported for details. Dairy.app main manifest (this file)
ANSWER
Answered 2021-Oct-05 at 10:38After the build has failed go to AndroidManifest.xml
and in the bottom click merged manifest see which activities which have intent-filter but don't have exported=true
attribute. Or you can just get the activities which are giving error.
Add these activities to your App manifest with android:exported="true"
and app tools:node="merge"
this will add exported attribute to the activities giving error.
Example:
1<?xml version="1.0" encoding="utf-8"?>
2<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3 package="com.xyz.abc">
4
5 <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
6 <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
7
8 <application
9 android:name=".framework.presentation.BaseApplication"
10 android:allowBackup="true"
11 android:icon="@mipmap/ic_launcher"
12 android:label="@string/app_name"
13 android:roundIcon="@mipmap/ic_launcher_round"
14 android:supportsRtl="true"
15 android:theme="@style/AppTheme">
16 <activity android:name="com.xyz.presentation.MainActivity"
17 android:exported="true">
18 <intent-filter>
19 <action android:name="android.intent.action.MAIN" />
20
21 <category android:name="android.intent.category.LAUNCHER" />
22 </intent-filter>
23 </activity>
24 </application>
25
26</manifest>
27 <activity
28 android:name="<activity which is giving error>"
29 android:exported="true"
30 tools:node="merge" />
31
You will have to do this once, you can remove this once the library developers update their libs.
QUESTION
Error importing Framer Motion v5 in React (with create-react-app)
Asked 2022-Mar-13 at 15:19When am trying to do simple animation for div using framer motion. Am getting this following error in browser
/node_modules/framer-motion/dist/es/components/AnimatePresence/index.mjs
1Can't import the named export 'Children' from non EcmaScript module (only default export is available)```
2
ANSWER
Answered 2021-Nov-01 at 16:16Here's the response to the issue from the Framer Discord
regarding the issue with the current version of create-react-app (CRA) the issue is being tracked on GitHub here: https://github.com/formatjs/formatjs/issues/1395
After testing a bit it seems that the issue is with how CRA handles ESM dependancies and more particularly transitive dependancies are not handled correctly it seems. There is also an outstanding issue with CRA about this https://github.com/facebook/create-react-app/issues/10356.
Options:
This is fixed/doesn't break in the next version of CRA which you can try today (https://github.com/facebook/create-react-app/discussions/11278) take note though its still in alpha.
You can patch CRA to get around the issue as described in a number of tickets from other libraries
QUESTION
Android Build Error: "lStar not found..."
Asked 2022-Feb-18 at 06:59I 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:18I 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
QUESTION
Make ModalBottomSheetLayout always Expanded
Asked 2022-Feb-09 at 10:50I am using ModalBottomSheetLayout
in Jetpack Compose. Whenever it is shown with modalBottomSheetState.show()
, it shows HalfExpanded
or Expanded
depending on the height of its content. This is from the source code:
1val anchors = if (sheetHeight < fullHeight / 2) {
2 mapOf(
3 fullHeight to Hidden,
4 fullHeight - sheetHeight to Expanded
5 )
6 } else {
7 mapOf(
8 fullHeight to Hidden,
9 fullHeight / 2 to HalfExpanded,
10 max(0f, fullHeight - sheetHeight) to Expanded
11 )
12 }
13 Modifier.swipeable(
14 state = sheetState,
15 anchors = anchors,
16 orientation = Orientation.Vertical,
17 enabled = sheetState.currentValue != Hidden,
18 resistance = null
19 )
20
Then show()
works like here:
1val anchors = if (sheetHeight < fullHeight / 2) {
2 mapOf(
3 fullHeight to Hidden,
4 fullHeight - sheetHeight to Expanded
5 )
6 } else {
7 mapOf(
8 fullHeight to Hidden,
9 fullHeight / 2 to HalfExpanded,
10 max(0f, fullHeight - sheetHeight) to Expanded
11 )
12 }
13 Modifier.swipeable(
14 state = sheetState,
15 anchors = anchors,
16 orientation = Orientation.Vertical,
17 enabled = sheetState.currentValue != Hidden,
18 resistance = null
19 )
20 internal val isHalfExpandedEnabled: Boolean
21 get() = anchors.values.contains(HalfExpanded)
22
23/**
24 * Show the bottom sheet with animation and suspend until it's shown. If half expand is
25 * enabled, the bottom sheet will be half expanded. Otherwise it will be fully expanded.
26 *
27 * @throws [CancellationException] if the animation is interrupted
28 */
29suspend fun show() {
30 val targetValue =
31 if (isHalfExpandedEnabled) HalfExpanded
32 else Expanded
33 animateTo(targetValue = targetValue)
34}
35
I wonder if we can set it to always Expanded
somehow
ANSWER
Answered 2021-Aug-23 at 09:56You can use:
1val anchors = if (sheetHeight < fullHeight / 2) {
2 mapOf(
3 fullHeight to Hidden,
4 fullHeight - sheetHeight to Expanded
5 )
6 } else {
7 mapOf(
8 fullHeight to Hidden,
9 fullHeight / 2 to HalfExpanded,
10 max(0f, fullHeight - sheetHeight) to Expanded
11 )
12 }
13 Modifier.swipeable(
14 state = sheetState,
15 anchors = anchors,
16 orientation = Orientation.Vertical,
17 enabled = sheetState.currentValue != Hidden,
18 resistance = null
19 )
20 internal val isHalfExpandedEnabled: Boolean
21 get() = anchors.values.contains(HalfExpanded)
22
23/**
24 * Show the bottom sheet with animation and suspend until it's shown. If half expand is
25 * enabled, the bottom sheet will be half expanded. Otherwise it will be fully expanded.
26 *
27 * @throws [CancellationException] if the animation is interrupted
28 */
29suspend fun show() {
30 val targetValue =
31 if (isHalfExpandedEnabled) HalfExpanded
32 else Expanded
33 animateTo(targetValue = targetValue)
34}
35scope.launch { state.animateTo(ModalBottomSheetValue.Expanded) }
36
instead of
1val anchors = if (sheetHeight < fullHeight / 2) {
2 mapOf(
3 fullHeight to Hidden,
4 fullHeight - sheetHeight to Expanded
5 )
6 } else {
7 mapOf(
8 fullHeight to Hidden,
9 fullHeight / 2 to HalfExpanded,
10 max(0f, fullHeight - sheetHeight) to Expanded
11 )
12 }
13 Modifier.swipeable(
14 state = sheetState,
15 anchors = anchors,
16 orientation = Orientation.Vertical,
17 enabled = sheetState.currentValue != Hidden,
18 resistance = null
19 )
20 internal val isHalfExpandedEnabled: Boolean
21 get() = anchors.values.contains(HalfExpanded)
22
23/**
24 * Show the bottom sheet with animation and suspend until it's shown. If half expand is
25 * enabled, the bottom sheet will be half expanded. Otherwise it will be fully expanded.
26 *
27 * @throws [CancellationException] if the animation is interrupted
28 */
29suspend fun show() {
30 val targetValue =
31 if (isHalfExpandedEnabled) HalfExpanded
32 else Expanded
33 animateTo(targetValue = targetValue)
34}
35scope.launch { state.animateTo(ModalBottomSheetValue.Expanded) }
36scope.launch { state.show() }
37
QUESTION
Project update recommended: Android Gradle Plugin can be upgraded. Error message: Can not find AGP version in build files
Asked 2022-Feb-06 at 03:17After a recommendation in Android Studio to upgrade Android Gradle Plugin from 7.0.0 to 7.0.2 the Upgrade Assistant notifies that Cannot find AGP version in build files, and therefore I am not able to do the upgrade.
What shall I do?
Thanks
Code at build.gradle (project)
1buildscript {
2 repositories {
3 google()
4 }
5 dependencies {
6 classpath Libs.androidGradlePlugin
7 classpath Libs.Kotlin.gradlePlugin
8 classpath Libs.Hilt.gradlePlugin
9 }
10}
11
12plugins {
13 id 'com.diffplug.spotless' version '5.12.4'
14}
15
16subprojects {
17 repositories {
18 google()
19 mavenCentral()
20
21 if (!Libs.AndroidX.Compose.snapshot.isEmpty()) {
22 maven { url Urls.composeSnapshotRepo }
23 }
24
25 if (Libs.Accompanist.version.endsWith('SNAPSHOT')) {
26 maven { url Urls.mavenCentralSnapshotRepo }
27 }
28 }
29
30 apply plugin: 'com.diffplug.spotless'
31 spotless {
32 kotlin {
33 target '**/*.kt'
34 targetExclude("$buildDir/**/*.kt")
35 targetExclude('bin/**/*.kt')
36 ktlint(Versions.ktLint)
37 licenseHeaderFile rootProject.file('spotless/copyright.kt')
38 }
39 }
40
41 tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
42 kotlinOptions {
43 jvmTarget = "1.8"
44
45 // Use experimental APIs
46 freeCompilerArgs += '-Xopt-in=kotlin.RequiresOptIn'
47 }
48 }
49 // androidx.test and hilt are forcing JUnit, 4.12. This forces them to use 4.13
50 configurations.configureEach {
51 resolutionStrategy {
52 force Libs.JUnit.junit
53 }
54 }
55}
56
57
Code at build.gradle (module)
1buildscript {
2 repositories {
3 google()
4 }
5 dependencies {
6 classpath Libs.androidGradlePlugin
7 classpath Libs.Kotlin.gradlePlugin
8 classpath Libs.Hilt.gradlePlugin
9 }
10}
11
12plugins {
13 id 'com.diffplug.spotless' version '5.12.4'
14}
15
16subprojects {
17 repositories {
18 google()
19 mavenCentral()
20
21 if (!Libs.AndroidX.Compose.snapshot.isEmpty()) {
22 maven { url Urls.composeSnapshotRepo }
23 }
24
25 if (Libs.Accompanist.version.endsWith('SNAPSHOT')) {
26 maven { url Urls.mavenCentralSnapshotRepo }
27 }
28 }
29
30 apply plugin: 'com.diffplug.spotless'
31 spotless {
32 kotlin {
33 target '**/*.kt'
34 targetExclude("$buildDir/**/*.kt")
35 targetExclude('bin/**/*.kt')
36 ktlint(Versions.ktLint)
37 licenseHeaderFile rootProject.file('spotless/copyright.kt')
38 }
39 }
40
41 tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
42 kotlinOptions {
43 jvmTarget = "1.8"
44
45 // Use experimental APIs
46 freeCompilerArgs += '-Xopt-in=kotlin.RequiresOptIn'
47 }
48 }
49 // androidx.test and hilt are forcing JUnit, 4.12. This forces them to use 4.13
50 configurations.configureEach {
51 resolutionStrategy {
52 force Libs.JUnit.junit
53 }
54 }
55}
56
57plugins {
58 id 'com.android.application'
59 id 'kotlin-android'
60 id 'kotlin-kapt'
61 id 'dagger.hilt.android.plugin'
62}
63
64// Reads the Google maps key that is used in the AndroidManifest
65Properties properties = new Properties()
66if (rootProject.file("local.properties").exists()) {
67 properties.load(rootProject.file("local.properties").newDataInputStream())
68}
69
70android {
71 compileSdkVersion 31
72 defaultConfig {
73 applicationId "androidx.compose.samples.crane"
74 minSdkVersion 21
75 targetSdkVersion 31
76 versionCode 1
77 versionName "1.0"
78 vectorDrawables.useSupportLibrary = true
79 testInstrumentationRunner "androidx.compose.samples.crane.CustomTestRunner"
80
81 manifestPlaceholders = [ googleMapsKey : properties.getProperty("google.maps.key", "") ]
82 }
83
84 signingConfigs {
85 // We use a bundled debug keystore, to allow debug builds from CI to be upgradable
86 // Cert fingerprint =
87 debug {
88 storeFile rootProject.file('debug.keystore')
89 storePassword 'xxxxxxxxxx'
90 keyAlias 'xxxxxxxxxxx'
91 keyPassword 'xxxxxxxxxx'
92 }
93 }
94
95 buildTypes {
96 debug {
97 signingConfig signingConfigs.debug
98 }
99
100 release {
101 minifyEnabled true
102 proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
103 }
104 }
105
106 compileOptions {
107 sourceCompatibility JavaVersion.VERSION_1_8
108 targetCompatibility JavaVersion.VERSION_1_8
109 }
110
111 kotlinOptions {
112 jvmTarget = "1.8"
113 }
114
115 buildFeatures {
116 compose true
117
118 // Disable unused AGP features
119 buildConfig false
120 aidl false
121 renderScript false
122 resValues false
123 shaders false
124 }
125
126 composeOptions {
127 kotlinCompilerExtensionVersion Libs.AndroidX.Compose.version
128 }
129
130 packagingOptions {
131 // Multiple dependency bring these files in. Exclude them to enable
132 // our test APK to build (has no effect on our AARs)
133 excludes += "/META-INF/AL2.0"
134 excludes += "/META-INF/LGPL2.1"
135 }
136}
137
138dependencies {
139 implementation Libs.Kotlin.stdlib
140 implementation Libs.Kotlin.Coroutines.android
141 implementation Libs.GoogleMaps.maps
142 implementation Libs.GoogleMaps.mapsKtx
143 constraints {
144 // Volley is a transitive dependency of maps
145 implementation(Libs.Volley.volley) {
146 because("Only volley 1.2.0 or newer are available on maven.google.com")
147 }
148 }
149
150 implementation Libs.Accompanist.insets
151 implementation Libs.AndroidX.Activity.activityCompose
152 implementation Libs.AndroidX.appcompat
153 implementation Libs.AndroidX.Compose.runtime
154 implementation Libs.AndroidX.Compose.foundation
155 implementation Libs.AndroidX.Compose.material
156 implementation Libs.AndroidX.Compose.layout
157 implementation Libs.AndroidX.Compose.animation
158 implementation Libs.AndroidX.Compose.tooling
159 implementation Libs.AndroidX.Lifecycle.viewModelCompose
160 implementation Libs.AndroidX.Lifecycle.viewModelKtx
161 implementation Libs.Coil.compose
162 implementation Libs.Hilt.android
163 kapt Libs.Hilt.compiler
164
165 androidTestImplementation Libs.JUnit.junit
166 androidTestImplementation Libs.AndroidX.Test.runner
167 androidTestImplementation Libs.AndroidX.Test.espressoCore
168 androidTestImplementation Libs.AndroidX.Test.rules
169 androidTestImplementation Libs.AndroidX.Test.Ext.junit
170 androidTestImplementation Libs.Kotlin.Coroutines.test
171 androidTestImplementation Libs.AndroidX.Compose.uiTest
172 androidTestImplementation Libs.Hilt.android
173 androidTestImplementation Libs.Hilt.testing
174 kaptAndroidTest Libs.Hilt.compiler
175}
176
Code at build.gradle.kts
1buildscript {
2 repositories {
3 google()
4 }
5 dependencies {
6 classpath Libs.androidGradlePlugin
7 classpath Libs.Kotlin.gradlePlugin
8 classpath Libs.Hilt.gradlePlugin
9 }
10}
11
12plugins {
13 id 'com.diffplug.spotless' version '5.12.4'
14}
15
16subprojects {
17 repositories {
18 google()
19 mavenCentral()
20
21 if (!Libs.AndroidX.Compose.snapshot.isEmpty()) {
22 maven { url Urls.composeSnapshotRepo }
23 }
24
25 if (Libs.Accompanist.version.endsWith('SNAPSHOT')) {
26 maven { url Urls.mavenCentralSnapshotRepo }
27 }
28 }
29
30 apply plugin: 'com.diffplug.spotless'
31 spotless {
32 kotlin {
33 target '**/*.kt'
34 targetExclude("$buildDir/**/*.kt")
35 targetExclude('bin/**/*.kt')
36 ktlint(Versions.ktLint)
37 licenseHeaderFile rootProject.file('spotless/copyright.kt')
38 }
39 }
40
41 tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
42 kotlinOptions {
43 jvmTarget = "1.8"
44
45 // Use experimental APIs
46 freeCompilerArgs += '-Xopt-in=kotlin.RequiresOptIn'
47 }
48 }
49 // androidx.test and hilt are forcing JUnit, 4.12. This forces them to use 4.13
50 configurations.configureEach {
51 resolutionStrategy {
52 force Libs.JUnit.junit
53 }
54 }
55}
56
57plugins {
58 id 'com.android.application'
59 id 'kotlin-android'
60 id 'kotlin-kapt'
61 id 'dagger.hilt.android.plugin'
62}
63
64// Reads the Google maps key that is used in the AndroidManifest
65Properties properties = new Properties()
66if (rootProject.file("local.properties").exists()) {
67 properties.load(rootProject.file("local.properties").newDataInputStream())
68}
69
70android {
71 compileSdkVersion 31
72 defaultConfig {
73 applicationId "androidx.compose.samples.crane"
74 minSdkVersion 21
75 targetSdkVersion 31
76 versionCode 1
77 versionName "1.0"
78 vectorDrawables.useSupportLibrary = true
79 testInstrumentationRunner "androidx.compose.samples.crane.CustomTestRunner"
80
81 manifestPlaceholders = [ googleMapsKey : properties.getProperty("google.maps.key", "") ]
82 }
83
84 signingConfigs {
85 // We use a bundled debug keystore, to allow debug builds from CI to be upgradable
86 // Cert fingerprint =
87 debug {
88 storeFile rootProject.file('debug.keystore')
89 storePassword 'xxxxxxxxxx'
90 keyAlias 'xxxxxxxxxxx'
91 keyPassword 'xxxxxxxxxx'
92 }
93 }
94
95 buildTypes {
96 debug {
97 signingConfig signingConfigs.debug
98 }
99
100 release {
101 minifyEnabled true
102 proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
103 }
104 }
105
106 compileOptions {
107 sourceCompatibility JavaVersion.VERSION_1_8
108 targetCompatibility JavaVersion.VERSION_1_8
109 }
110
111 kotlinOptions {
112 jvmTarget = "1.8"
113 }
114
115 buildFeatures {
116 compose true
117
118 // Disable unused AGP features
119 buildConfig false
120 aidl false
121 renderScript false
122 resValues false
123 shaders false
124 }
125
126 composeOptions {
127 kotlinCompilerExtensionVersion Libs.AndroidX.Compose.version
128 }
129
130 packagingOptions {
131 // Multiple dependency bring these files in. Exclude them to enable
132 // our test APK to build (has no effect on our AARs)
133 excludes += "/META-INF/AL2.0"
134 excludes += "/META-INF/LGPL2.1"
135 }
136}
137
138dependencies {
139 implementation Libs.Kotlin.stdlib
140 implementation Libs.Kotlin.Coroutines.android
141 implementation Libs.GoogleMaps.maps
142 implementation Libs.GoogleMaps.mapsKtx
143 constraints {
144 // Volley is a transitive dependency of maps
145 implementation(Libs.Volley.volley) {
146 because("Only volley 1.2.0 or newer are available on maven.google.com")
147 }
148 }
149
150 implementation Libs.Accompanist.insets
151 implementation Libs.AndroidX.Activity.activityCompose
152 implementation Libs.AndroidX.appcompat
153 implementation Libs.AndroidX.Compose.runtime
154 implementation Libs.AndroidX.Compose.foundation
155 implementation Libs.AndroidX.Compose.material
156 implementation Libs.AndroidX.Compose.layout
157 implementation Libs.AndroidX.Compose.animation
158 implementation Libs.AndroidX.Compose.tooling
159 implementation Libs.AndroidX.Lifecycle.viewModelCompose
160 implementation Libs.AndroidX.Lifecycle.viewModelKtx
161 implementation Libs.Coil.compose
162 implementation Libs.Hilt.android
163 kapt Libs.Hilt.compiler
164
165 androidTestImplementation Libs.JUnit.junit
166 androidTestImplementation Libs.AndroidX.Test.runner
167 androidTestImplementation Libs.AndroidX.Test.espressoCore
168 androidTestImplementation Libs.AndroidX.Test.rules
169 androidTestImplementation Libs.AndroidX.Test.Ext.junit
170 androidTestImplementation Libs.Kotlin.Coroutines.test
171 androidTestImplementation Libs.AndroidX.Compose.uiTest
172 androidTestImplementation Libs.Hilt.android
173 androidTestImplementation Libs.Hilt.testing
174 kaptAndroidTest Libs.Hilt.compiler
175}
176repositories {
177 jcenter()
178}
179
180plugins {
181 `kotlin-dsl`
182}
183
ANSWER
Answered 2022-Feb-06 at 03:17I don't know if it is critical for your problem but modifying this
1buildscript {
2 repositories {
3 google()
4 }
5 dependencies {
6 classpath Libs.androidGradlePlugin
7 classpath Libs.Kotlin.gradlePlugin
8 classpath Libs.Hilt.gradlePlugin
9 }
10}
11
12plugins {
13 id 'com.diffplug.spotless' version '5.12.4'
14}
15
16subprojects {
17 repositories {
18 google()
19 mavenCentral()
20
21 if (!Libs.AndroidX.Compose.snapshot.isEmpty()) {
22 maven { url Urls.composeSnapshotRepo }
23 }
24
25 if (Libs.Accompanist.version.endsWith('SNAPSHOT')) {
26 maven { url Urls.mavenCentralSnapshotRepo }
27 }
28 }
29
30 apply plugin: 'com.diffplug.spotless'
31 spotless {
32 kotlin {
33 target '**/*.kt'
34 targetExclude("$buildDir/**/*.kt")
35 targetExclude('bin/**/*.kt')
36 ktlint(Versions.ktLint)
37 licenseHeaderFile rootProject.file('spotless/copyright.kt')
38 }
39 }
40
41 tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
42 kotlinOptions {
43 jvmTarget = "1.8"
44
45 // Use experimental APIs
46 freeCompilerArgs += '-Xopt-in=kotlin.RequiresOptIn'
47 }
48 }
49 // androidx.test and hilt are forcing JUnit, 4.12. This forces them to use 4.13
50 configurations.configureEach {
51 resolutionStrategy {
52 force Libs.JUnit.junit
53 }
54 }
55}
56
57plugins {
58 id 'com.android.application'
59 id 'kotlin-android'
60 id 'kotlin-kapt'
61 id 'dagger.hilt.android.plugin'
62}
63
64// Reads the Google maps key that is used in the AndroidManifest
65Properties properties = new Properties()
66if (rootProject.file("local.properties").exists()) {
67 properties.load(rootProject.file("local.properties").newDataInputStream())
68}
69
70android {
71 compileSdkVersion 31
72 defaultConfig {
73 applicationId "androidx.compose.samples.crane"
74 minSdkVersion 21
75 targetSdkVersion 31
76 versionCode 1
77 versionName "1.0"
78 vectorDrawables.useSupportLibrary = true
79 testInstrumentationRunner "androidx.compose.samples.crane.CustomTestRunner"
80
81 manifestPlaceholders = [ googleMapsKey : properties.getProperty("google.maps.key", "") ]
82 }
83
84 signingConfigs {
85 // We use a bundled debug keystore, to allow debug builds from CI to be upgradable
86 // Cert fingerprint =
87 debug {
88 storeFile rootProject.file('debug.keystore')
89 storePassword 'xxxxxxxxxx'
90 keyAlias 'xxxxxxxxxxx'
91 keyPassword 'xxxxxxxxxx'
92 }
93 }
94
95 buildTypes {
96 debug {
97 signingConfig signingConfigs.debug
98 }
99
100 release {
101 minifyEnabled true
102 proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
103 }
104 }
105
106 compileOptions {
107 sourceCompatibility JavaVersion.VERSION_1_8
108 targetCompatibility JavaVersion.VERSION_1_8
109 }
110
111 kotlinOptions {
112 jvmTarget = "1.8"
113 }
114
115 buildFeatures {
116 compose true
117
118 // Disable unused AGP features
119 buildConfig false
120 aidl false
121 renderScript false
122 resValues false
123 shaders false
124 }
125
126 composeOptions {
127 kotlinCompilerExtensionVersion Libs.AndroidX.Compose.version
128 }
129
130 packagingOptions {
131 // Multiple dependency bring these files in. Exclude them to enable
132 // our test APK to build (has no effect on our AARs)
133 excludes += "/META-INF/AL2.0"
134 excludes += "/META-INF/LGPL2.1"
135 }
136}
137
138dependencies {
139 implementation Libs.Kotlin.stdlib
140 implementation Libs.Kotlin.Coroutines.android
141 implementation Libs.GoogleMaps.maps
142 implementation Libs.GoogleMaps.mapsKtx
143 constraints {
144 // Volley is a transitive dependency of maps
145 implementation(Libs.Volley.volley) {
146 because("Only volley 1.2.0 or newer are available on maven.google.com")
147 }
148 }
149
150 implementation Libs.Accompanist.insets
151 implementation Libs.AndroidX.Activity.activityCompose
152 implementation Libs.AndroidX.appcompat
153 implementation Libs.AndroidX.Compose.runtime
154 implementation Libs.AndroidX.Compose.foundation
155 implementation Libs.AndroidX.Compose.material
156 implementation Libs.AndroidX.Compose.layout
157 implementation Libs.AndroidX.Compose.animation
158 implementation Libs.AndroidX.Compose.tooling
159 implementation Libs.AndroidX.Lifecycle.viewModelCompose
160 implementation Libs.AndroidX.Lifecycle.viewModelKtx
161 implementation Libs.Coil.compose
162 implementation Libs.Hilt.android
163 kapt Libs.Hilt.compiler
164
165 androidTestImplementation Libs.JUnit.junit
166 androidTestImplementation Libs.AndroidX.Test.runner
167 androidTestImplementation Libs.AndroidX.Test.espressoCore
168 androidTestImplementation Libs.AndroidX.Test.rules
169 androidTestImplementation Libs.AndroidX.Test.Ext.junit
170 androidTestImplementation Libs.Kotlin.Coroutines.test
171 androidTestImplementation Libs.AndroidX.Compose.uiTest
172 androidTestImplementation Libs.Hilt.android
173 androidTestImplementation Libs.Hilt.testing
174 kaptAndroidTest Libs.Hilt.compiler
175}
176repositories {
177 jcenter()
178}
179
180plugins {
181 `kotlin-dsl`
182}
183repositories {
184 jcenter()
185}
186
to
1buildscript {
2 repositories {
3 google()
4 }
5 dependencies {
6 classpath Libs.androidGradlePlugin
7 classpath Libs.Kotlin.gradlePlugin
8 classpath Libs.Hilt.gradlePlugin
9 }
10}
11
12plugins {
13 id 'com.diffplug.spotless' version '5.12.4'
14}
15
16subprojects {
17 repositories {
18 google()
19 mavenCentral()
20
21 if (!Libs.AndroidX.Compose.snapshot.isEmpty()) {
22 maven { url Urls.composeSnapshotRepo }
23 }
24
25 if (Libs.Accompanist.version.endsWith('SNAPSHOT')) {
26 maven { url Urls.mavenCentralSnapshotRepo }
27 }
28 }
29
30 apply plugin: 'com.diffplug.spotless'
31 spotless {
32 kotlin {
33 target '**/*.kt'
34 targetExclude("$buildDir/**/*.kt")
35 targetExclude('bin/**/*.kt')
36 ktlint(Versions.ktLint)
37 licenseHeaderFile rootProject.file('spotless/copyright.kt')
38 }
39 }
40
41 tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
42 kotlinOptions {
43 jvmTarget = "1.8"
44
45 // Use experimental APIs
46 freeCompilerArgs += '-Xopt-in=kotlin.RequiresOptIn'
47 }
48 }
49 // androidx.test and hilt are forcing JUnit, 4.12. This forces them to use 4.13
50 configurations.configureEach {
51 resolutionStrategy {
52 force Libs.JUnit.junit
53 }
54 }
55}
56
57plugins {
58 id 'com.android.application'
59 id 'kotlin-android'
60 id 'kotlin-kapt'
61 id 'dagger.hilt.android.plugin'
62}
63
64// Reads the Google maps key that is used in the AndroidManifest
65Properties properties = new Properties()
66if (rootProject.file("local.properties").exists()) {
67 properties.load(rootProject.file("local.properties").newDataInputStream())
68}
69
70android {
71 compileSdkVersion 31
72 defaultConfig {
73 applicationId "androidx.compose.samples.crane"
74 minSdkVersion 21
75 targetSdkVersion 31
76 versionCode 1
77 versionName "1.0"
78 vectorDrawables.useSupportLibrary = true
79 testInstrumentationRunner "androidx.compose.samples.crane.CustomTestRunner"
80
81 manifestPlaceholders = [ googleMapsKey : properties.getProperty("google.maps.key", "") ]
82 }
83
84 signingConfigs {
85 // We use a bundled debug keystore, to allow debug builds from CI to be upgradable
86 // Cert fingerprint =
87 debug {
88 storeFile rootProject.file('debug.keystore')
89 storePassword 'xxxxxxxxxx'
90 keyAlias 'xxxxxxxxxxx'
91 keyPassword 'xxxxxxxxxx'
92 }
93 }
94
95 buildTypes {
96 debug {
97 signingConfig signingConfigs.debug
98 }
99
100 release {
101 minifyEnabled true
102 proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
103 }
104 }
105
106 compileOptions {
107 sourceCompatibility JavaVersion.VERSION_1_8
108 targetCompatibility JavaVersion.VERSION_1_8
109 }
110
111 kotlinOptions {
112 jvmTarget = "1.8"
113 }
114
115 buildFeatures {
116 compose true
117
118 // Disable unused AGP features
119 buildConfig false
120 aidl false
121 renderScript false
122 resValues false
123 shaders false
124 }
125
126 composeOptions {
127 kotlinCompilerExtensionVersion Libs.AndroidX.Compose.version
128 }
129
130 packagingOptions {
131 // Multiple dependency bring these files in. Exclude them to enable
132 // our test APK to build (has no effect on our AARs)
133 excludes += "/META-INF/AL2.0"
134 excludes += "/META-INF/LGPL2.1"
135 }
136}
137
138dependencies {
139 implementation Libs.Kotlin.stdlib
140 implementation Libs.Kotlin.Coroutines.android
141 implementation Libs.GoogleMaps.maps
142 implementation Libs.GoogleMaps.mapsKtx
143 constraints {
144 // Volley is a transitive dependency of maps
145 implementation(Libs.Volley.volley) {
146 because("Only volley 1.2.0 or newer are available on maven.google.com")
147 }
148 }
149
150 implementation Libs.Accompanist.insets
151 implementation Libs.AndroidX.Activity.activityCompose
152 implementation Libs.AndroidX.appcompat
153 implementation Libs.AndroidX.Compose.runtime
154 implementation Libs.AndroidX.Compose.foundation
155 implementation Libs.AndroidX.Compose.material
156 implementation Libs.AndroidX.Compose.layout
157 implementation Libs.AndroidX.Compose.animation
158 implementation Libs.AndroidX.Compose.tooling
159 implementation Libs.AndroidX.Lifecycle.viewModelCompose
160 implementation Libs.AndroidX.Lifecycle.viewModelKtx
161 implementation Libs.Coil.compose
162 implementation Libs.Hilt.android
163 kapt Libs.Hilt.compiler
164
165 androidTestImplementation Libs.JUnit.junit
166 androidTestImplementation Libs.AndroidX.Test.runner
167 androidTestImplementation Libs.AndroidX.Test.espressoCore
168 androidTestImplementation Libs.AndroidX.Test.rules
169 androidTestImplementation Libs.AndroidX.Test.Ext.junit
170 androidTestImplementation Libs.Kotlin.Coroutines.test
171 androidTestImplementation Libs.AndroidX.Compose.uiTest
172 androidTestImplementation Libs.Hilt.android
173 androidTestImplementation Libs.Hilt.testing
174 kaptAndroidTest Libs.Hilt.compiler
175}
176repositories {
177 jcenter()
178}
179
180plugins {
181 `kotlin-dsl`
182}
183repositories {
184 jcenter()
185}
186repositories {
187 mavenCentral()
188}
189
should be needed. Because jcenter()
is obsolete.
QUESTION
Angular TSLint - Cannot find builder "@angular-devkit/build-angular:tslint"
Asked 2022-Jan-04 at 13:18When I try to run command ng lint --fix
cli throws this error:
1An unhandled exception occurred: Cannot find builder "@angular-devkit/build-angular:tslint".
2See "C:\Users\MOE89A~1.ZAR\AppData\Local\Temp\ng-Ijc3an\angular-errors.log" for further details.
3
My lint confing in angular.json
:
1An unhandled exception occurred: Cannot find builder "@angular-devkit/build-angular:tslint".
2See "C:\Users\MOE89A~1.ZAR\AppData\Local\Temp\ng-Ijc3an\angular-errors.log" for further details.
3"lint": {
4 "builder": "@angular-devkit/build-angular:tslint",
5 "options": {
6 "tsConfig": [
7 "projects/wepod-app/tsconfig.app.json",
8 "projects/wepod-app/tsconfig.spec.json",
9 "projects/wepod-app/e2e/tsconfig.json"
10 ],
11 "exclude": [
12 "**/node_modules/**"
13 ]
14 }
15},
16
My package.json
:
1An unhandled exception occurred: Cannot find builder "@angular-devkit/build-angular:tslint".
2See "C:\Users\MOE89A~1.ZAR\AppData\Local\Temp\ng-Ijc3an\angular-errors.log" for further details.
3"lint": {
4 "builder": "@angular-devkit/build-angular:tslint",
5 "options": {
6 "tsConfig": [
7 "projects/wepod-app/tsconfig.app.json",
8 "projects/wepod-app/tsconfig.spec.json",
9 "projects/wepod-app/e2e/tsconfig.json"
10 ],
11 "exclude": [
12 "**/node_modules/**"
13 ]
14 }
15},
16{
17 "name": "wepod-clients",
18 "version": "3.2.3",
19 "scripts": {
20 "ng": "ng",
21 "start": "node patch.js && ng serve",
22 "build": "node patch.js && node --max_old_space_size=8192 ./node_modules/@angular/cli/bin/ng run wepod-app:app-shell:production && ng run wepod-app:auth-standalone:production",
23 "server": "npm run build && http-server -p 9090 -c-1 dist",
24 "test": "ng test",
25 "lint": "ng lint --fix",
26 "e2e": "ng e2e",
27 "postinstall": "node patch.js && ngcc",
28 "postbuild": "node post-build.js",
29 "prepare": "husky install",
30 "build-latest": "git pull origin production && npm run build"
31 },
32 "private": true,
33 "dependencies": {
34 "@angular/animations": "^13.0.0",
35 "@angular/cdk": "^13.0.0",
36 "@angular/cli": "^13.0.1",
37 "@angular/common": "^13.0.0",
38 "@angular/compiler": "^13.0.0",
39 "@angular/core": "^13.0.0",
40 "@angular/forms": "^13.0.0",
41 "@angular/localize": "^13.0.0",
42 "@angular/platform-browser": "^13.0.0",
43 "@angular/platform-browser-dynamic": "^13.0.0",
44 "@angular/platform-server": "^13.0.0",
45 "@angular/router": "^13.0.0",
46 "@angular/service-worker": "^13.0.0",
47 "@types/video.js": "^7.3.27",
48 "animate.css": "^4.1.1",
49 "assert": "^2.0.0",
50 "bowser": "^2.11.0",
51 "buffer": "^6.0.3",
52 "bundle-loader": "^0.5.6",
53 "compare-version": "^0.1.2",
54 "constants-browserify": "^1.0.0",
55 "crypto-browserify": "^3.12.0",
56 "crypto-js": "^4.1.1",
57 "d3": "^6.5.0",
58 "hammerjs": "^2.0.8",
59 "https-browserify": "^1.0.0",
60 "jalali-moment": "^3.3.10",
61 "lottie-web": "^5.7.13",
62 "lzutf8": "^0.6.0",
63 "net": "^1.0.2",
64 "ng-gallery": "^5.1.1",
65 "ng2-jalali-date-picker": "^2.4.2",
66 "ngx-device-detector": "^1.5.2",
67 "ngx-doughnut-chart": "0.0.4",
68 "ngx-infinite-scroll": "^8.0.2",
69 "ngx-lottie": "^7.0.4",
70 "ngx-owl-carousel-o": "^3.1.1",
71 "ngx-skeleton-loader": "^2.10.1",
72 "ngx-toastr": "^12.1.0",
73 "os-browserify": "^0.3.0",
74 "podchat-browser": "^10.14.13",
75 "rxjs": "^6.6.7",
76 "stream-browserify": "^3.0.0",
77 "stream-http": "^3.2.0",
78 "tls": "0.0.1",
79 "tslib": "^2.0.0",
80 "uuid": "^8.3.2",
81 "video.js": "^7.15.4",
82 "videojs-record": "^4.5.0",
83 "zone.js": "~0.11.4"
84 },
85 "devDependencies": {
86 "@angular-devkit/build-angular": "^13.0.1",
87 "@angular-devkit/core": "^13.0.1",
88 "@angular/compiler-cli": "^13.0.0",
89 "@angular/language-service": "^13.0.0",
90 "@egjs/hammerjs": "^2.0.17",
91 "@types/hammerjs": "^2.0.40",
92 "@types/jasmine": "~3.6.0",
93 "@types/jasminewd2": "^2.0.10",
94 "@types/node": "^12.20.36",
95 "codelyzer": "^6.0.0",
96 "colors": "^1.4.0",
97 "git-tag-version": "^1.3.1",
98 "gulp": "^4.0.2",
99 "gulp-gzip": "^1.4.2",
100 "http-server": "^14.0.0",
101 "husky": "^7.0.4",
102 "jasmine-core": "~3.6.0",
103 "jasmine-spec-reporter": "~5.0.0",
104 "karma": "^6.3.7",
105 "karma-chrome-launcher": "~3.1.0",
106 "karma-coverage-istanbul-reporter": "^2.1.0",
107 "karma-jasmine": "~4.0.0",
108 "karma-jasmine-html-reporter": "^1.5.0",
109 "protractor": "^7.0.0",
110 "ts-node": "^8.10.2",
111 "tslint": "^6.1.3",
112 "typescript": "4.4.4",
113 "zip-dir": "^2.0.0"
114 },
115 "browser": {
116 "fs": false,
117 "path": false,
118 "os": false
119 }
120}
121
ANSWER
Answered 2021-Nov-28 at 10:34From v13 angular doesn't use tslint
anymore due to deprecation.
Run ng add @angular-eslint/schematics
to add eslint
to your application.
It will use tslint-to-eslint-config to migrate you to eslint
automatically.
It will generate a .eslintrc.json
file and migrate tslint.json
to it.
Nothing else is needed to be done.
QUESTION
SVG stop running chained animation (<animate> tag)
Asked 2021-Dec-26 at 09:01I have an animated SVG where each <path>
starts after its previous <path>
. The first <path>
starts on click or 0s.
I have a problem with stopping the animation (without JS, only in XML). I press click, the animation starts. Before the entire animation ends I press click and trigger a new animation. However the previous animation continues to run and it messes up all <path>
s starting from 2.
I have tried different options (begin
with time offsets; begin
with id.end
), but I haven't found a solution. Maybe someone who is more experiences with SVG than me could help me?
Here is my SVG:
1<svg xmlns="http://www.w3.org/2000/svg" width="109" height="109" viewBox="0 0 109 109" id="3005">
2<g fill="none" stroke="#666" stroke-width="9" stroke-linecap="round" stroke-linejoin="round">
3 <g>
4 <path d="M50.75,19.5c0.1,1.3,0.37,3.74-0.19,5.21C43.57,43,32.73,60.29,14.5,75.04" />
5 <path d="M45,44.35c1.05,0,3.62,0.35,6.26,0.1c9.18-0.85,25.21-3.31,29.06-3.67c4.26-0.4,6.46,4.28,4.68,6.25C78.32,54.46,67.5,67,57.81,79.22" />
6 <path d="M42.52,68.33c10.16,5.01,26.25,20.59,28.79,28.38" />
7 </g>
8</g>
9<g fill="none" stroke="#000" stroke-width="5" stroke-linecap="round" stroke-linejoin="round">
10 <g>
11 <path d="M50.75,19.5c0.1,1.3,0.37,3.74-0.19,5.21C43.57,43,32.73,60.29,14.5,75.04" stroke-dasharray="67.92" stroke-dashoffset="67.92">
12 <animate id="0" attributeName="stroke-dashoffset" values="67.92;0" dur="0.51s" fill="freeze" begin="0s;3005.click" />
13 </path>
14 <path d="M45,44.35c1.05,0,3.62,0.35,6.26,0.1c9.18-0.85,25.21-3.31,29.06-3.67c4.26-0.4,6.46,4.28,4.68,6.25C78.32,54.46,67.5,67,57.81,79.22" stroke-dasharray="87.4" stroke-dashoffset="87.4">
15 <animate attributeName="stroke-dashoffset" values="87.4" fill="freeze" begin="3005.click" />
16 <animate id="1" attributeName="stroke-dashoffset" values="87.4;0" dur="0.66s" fill="freeze" begin="0.end" />
17 </path>
18 <path d="M42.52,68.33c10.16,5.01,26.25,20.59,28.79,28.38" stroke-dasharray="41.01" stroke-dashoffset="41.01">
19 <animate attributeName="stroke-dashoffset" values="41.01" fill="freeze" begin="3005.click" />
20 <animate id="2" attributeName="stroke-dashoffset" values="41.01;0" dur="0.41s" fill="freeze" begin="1.end" />
21 </path>
22 </g>
23</g>
24</svg>
And here is the problem:
So, on the picture it's clear that the chained animation is not stopped when I click the pictue :(
ANSWER
Answered 2021-Dec-26 at 09:01Instead of chaining animations off one another, have all the animations begin="0s; 3005.click"
. Then they will all reset when you click.
You can use keyPoints
and keyTimes
, to control when each of the animations starts. So you can still have your staggered starts.
1<svg xmlns="http://www.w3.org/2000/svg" width="109" height="109" viewBox="0 0 109 109" id="3005">
2<g fill="none" stroke="#666" stroke-width="9" stroke-linecap="round" stroke-linejoin="round">
3 <g>
4 <path d="M50.75,19.5c0.1,1.3,0.37,3.74-0.19,5.21C43.57,43,32.73,60.29,14.5,75.04" />
5 <path d="M45,44.35c1.05,0,3.62,0.35,6.26,0.1c9.18-0.85,25.21-3.31,29.06-3.67c4.26-0.4,6.46,4.28,4.68,6.25C78.32,54.46,67.5,67,57.81,79.22" />
6 <path d="M42.52,68.33c10.16,5.01,26.25,20.59,28.79,28.38" />
7 </g>
8</g>
9<g fill="none" stroke="#000" stroke-width="5" stroke-linecap="round" stroke-linejoin="round">
10 <g>
11 <path d="M50.75,19.5c0.1,1.3,0.37,3.74-0.19,5.21C43.57,43,32.73,60.29,14.5,75.04" stroke-dasharray="67.92" stroke-dashoffset="67.92">
12 <animate id="0" attributeName="stroke-dashoffset" values="67.92;0" dur="0.51s" fill="freeze" begin="0s;3005.click" />
13 </path>
14 <path d="M45,44.35c1.05,0,3.62,0.35,6.26,0.1c9.18-0.85,25.21-3.31,29.06-3.67c4.26-0.4,6.46,4.28,4.68,6.25C78.32,54.46,67.5,67,57.81,79.22" stroke-dasharray="87.4" stroke-dashoffset="87.4">
15 <animate attributeName="stroke-dashoffset" values="87.4" fill="freeze" begin="3005.click" />
16 <animate id="1" attributeName="stroke-dashoffset" values="87.4;0" dur="0.66s" fill="freeze" begin="0.end" />
17 </path>
18 <path d="M42.52,68.33c10.16,5.01,26.25,20.59,28.79,28.38" stroke-dasharray="41.01" stroke-dashoffset="41.01">
19 <animate attributeName="stroke-dashoffset" values="41.01" fill="freeze" begin="3005.click" />
20 <animate id="2" attributeName="stroke-dashoffset" values="41.01;0" dur="0.41s" fill="freeze" begin="1.end" />
21 </path>
22 </g>
23</g>
24</svg><svg xmlns="http://www.w3.org/2000/svg" width="109" height="109" viewBox="0 0 109 109" id="3005">
25<g fill="none" stroke="#666" stroke-width="9" stroke-linecap="round" stroke-linejoin="round">
26 <g>
27 <path d="M50.75,19.5c0.1,1.3,0.37,3.74-0.19,5.21C43.57,43,32.73,60.29,14.5,75.04" />
28 <path d="M45,44.35c1.05,0,3.62,0.35,6.26,0.1c9.18-0.85,25.21-3.31,29.06-3.67c4.26-0.4,6.46,4.28,4.68,6.25C78.32,54.46,67.5,67,57.81,79.22" />
29 <path d="M42.52,68.33c10.16,5.01,26.25,20.59,28.79,28.38" />
30 </g>
31</g>
32<g fill="none" stroke="#000" stroke-width="5" stroke-linecap="round" stroke-linejoin="round">
33 <g>
34 <path d="M50.75,19.5c0.1,1.3,0.37,3.74-0.19,5.21C43.57,43,32.73,60.29,14.5,75.04" stroke-dasharray="67.92" stroke-dashoffset="67.92">
35 <animate attributeName="stroke-dashoffset" values="67.92;0" dur="0.51s" fill="freeze" begin="0s;3005.click" />
36 </path>
37 <path d="M45,44.35c1.05,0,3.62,0.35,6.26,0.1c9.18-0.85,25.21-3.31,29.06-3.67c4.26-0.4,6.46,4.28,4.68,6.25C78.32,54.46,67.5,67,57.81,79.22" stroke-dasharray="87.4" stroke-dashoffset="87.4">
38 <animate attributeName="stroke-dashoffset" values="87.4" fill="freeze" begin="3005.click" />
39 <animate attributeName="stroke-dashoffset" values="87.4;87.4;0" keyTimes="0;0.444;1" dur="1.17s" fill="freeze" begin="0s;3005.click" />
40 </path>
41 <path d="M42.52,68.33c10.16,5.01,26.25,20.59,28.79,28.38" stroke-dasharray="41.01" stroke-dashoffset="41.01">
42 <animate attributeName="stroke-dashoffset" values="41.01" fill="freeze" begin="3005.click" />
43 <animate attributeName="stroke-dashoffset" values="41.01;41.01;0" keyTimes="0;0.75;1" dur="1.58s" fill="freeze" begin="0s;3005.click" />
44 </path>
45 </g>
46</g>
47</svg>
QUESTION
How to replace deprecated .animation() in SwiftUI?
Asked 2021-Nov-28 at 16:09The .animation()
modifier has been deprecated in iOS 15, but I'm not sure I understand how Xcode's suggested equivalent, animation(_:value:)
, works.
1.animation(.easeInOut(duration: 2)) // ⚠️'animation' was deprecated in iOS 15.0: Use withAnimation or animation(_:value:) instead.
2
How would I change my code to get rid of the warning?
ANSWER
Answered 2021-Oct-05 at 00:30.animation
now takes a second argument called value
.
https://developer.apple.com/documentation/swiftui/view/animation(_:value:)
Community Discussions contain sources that include Stack Exchange Network
Tutorials and Learning Resources in Animation
Tutorials and Learning Resources are not available at this moment for Animation