Showing posts with label Jetpack. Show all posts
Showing posts with label Jetpack. Show all posts

Tuesday, October 16, 2018

Hello World, Androidx

Posted past times Alan Viverette (/u/alanviverette), Kathy Kam (@kathykam) , Lukas Bergstrom (@lukasb)

Today, nosotros launch an early on preview of the novel Android extension libraries (AndroidX) which represents a novel era for the Support Library. Please preview the change as well as make us your feedback. Since this is an early on preview, nosotros practise non recommend trying this on whatever production projects equally at that topographic point are approximately known issues.

The Support Library started over 7+ years agone to render backwards compatibility to framework APIs. Over the years, the library has grown to include device-specific UX, debugging, testing as well as other utilities. The adoption of the Support Library has been phenomenal; most Android apps purpose the Support Library today. We desire to increase our investment inwards this area, as well as it is critical that nosotros lay a company foundation.

In that vein, nosotros took a measuring dorsum as well as chatted alongside many of you. The feedback has been consistent as well as unanimous; the organic growth of the library has larn confusing. There are components as well as packages named "v7" when the minimal SDK marker nosotros back upwards is 14! We desire to arrive clear for y'all to empathize the sectionalisation betwixt APIs that are bundled alongside the platform as well as which are static libraries for app developers that locomote across dissimilar versions of Android.

With that inwards mind, tell "Hello World" to "AndroidX". As previously noted inwards the Android KTX announcement, nosotros are adding novel features nether this package, as well as updating approximately existing ones.

android.* vs androidx.* namespaces

Writing Android apps agency depending on ii kinds of classes:

  • Classes similar PackageManager, which are bundled alongside the operating arrangement as well as tin stimulate got dissimilar APIs as well as conduct for dissimilar Android versions
  • Classes similar AppCompatActivity or ViewModel, which are unbundled from the operating arrangement as well as send inwards your apk. These libraries are written to render a unmarried API surface alongside conduct that's equally consistent equally possible across Android versions.

Many times, unbundled libraries tin locomote a improve choice, since they render a unmarried API surface across dissimilar Android versions. This refactor moves the unbundled libraries - including all of the Support Library as well as Architecture Components - into the AndroidX package, to arrive clear to know which dependencies to include.

Revised naming for packages as well as Maven artifacts

We redesigned the packet construction to encourage smaller, to a greater extent than focused libraries that salve pressure level on apps as well as tests that aren't using Proguard or Multidex. Maven groupIds as well as artifactIds stimulate got been updated to improve reverberate library contents, as well as nosotros stimulate got moved to prefixing library packages alongside their groupId to practise an obvious link betwixt the shape that y'all are using as well as the Maven artifact from which it came.

Generally, y'all tin hold off the next mapping from onetime to novel packages:

Old New
android.support.** androidx.@
android.databinding.** androidx.databinding.@
android.design.** com.google.android.material.@
android.support.test.** (in a futurity release) androidx.test.@

The Architecture Components libraries stimulate got also been moved nether androidx as well as their packet names simplified to reverberate their integration alongside heart as well as individual libraries. H5N1 sample of changes to these libraries:

Old New
android.arch.** androidx.@
android.arch.persistence.room.** androidx.room.@
android.arch.persistence.** androidx.sqlite.@

Additionally, next the introduction inwards 28.0.0-alpha1 of Material Components for Android equally a drop-in replacement for Design Library, nosotros stimulate got refactored the blueprint packet to reverberate its novel direction.

For a consummate listing of mappings from 28.0.0-alpha1 (android.support) to 1.0.0-alpha1 (androidx), delight regard the total AndroidX refactoring map. Please banking concern complaint that at that topographic point may locomote nipper changes to this map during the alpha phase.

Per-artifact strict semantic versioning

Starting alongside the AndroidX refactor, library versions stimulate got been reset from 28.0.0 to 1.0.0. Future updates volition locomote versioned on a per-library basis, next strict semantic versioning rules where the major version indicates binary compatibility. This means, for example, that a characteristic may locomote added to RecyclerView as well as used inwards your app without requiring an update to every other library used past times your app. This also agency that libraries depending on androidx may render reasonable guarantees virtually binary compatibility alongside futurity releases of AndroidX -- that a dependency on a 1.5.0 revision volition soundless locomote when run against 1.7.0 but volition probable non locomote against 2.0.0.

Migration from 28.0.0-alpha1

Moving your app from android.support to androidx-packaged dependencies has ii major parts: source refactoring as well as dependency translation.

Source refactoring updates your Java code, XML resources, as well as Gradle configuration to reference the refactored classes as well as Maven artifacts. This characteristic is available inwards Android Studio Canary 14 for applications targeting Android P.

If y'all depend on a library that references the older Support Library, Android Studio volition update that library to reference androidx instead via dependency translation. Dependency translation is automatically applied past times the Android Gradle Plugin 3.2.0-alpha14, which rewrites bytecode as well as resources of JAR as well as AAR dependencies (and transitive dependencies) to reference the novel androidx-packaged classes as well as artifacts. We volition also render a standalone translation tool equally a JAR.

What's next?

We empathize this is a big alter for existing projects as well as codebases. Our intention is to render a rigid foundation that sets Android library projects upwards for to a greater extent than sustainable growth, improve modularity, as well as smaller code size.

We promise that these changes also arrive easier for developers to break features as well as implement high-quality apps inwards less time; however, nosotros empathize that migration takes fourth dimension as well as may non check into everyone's production schedule. For this reason, nosotros volition maintain to render parallel updates to an android.support-packaged laid of libraries for the duration of the P preview SDK timeframe. These updates volition maintain the 28.0.0 versioning system that began alongside 28.0.0-alpha1 inwards March 2018, as well as they volition maintain to locomote source-compatible alongside existing projects that depend on the android.support package.

The stable loose of 28.0.0 volition locomote the terminal characteristic loose packaged equally android.support. All subsequent characteristic releases volition simply locomote made available equally androidx-packaged artifacts.

We'd dear to listen from y'all equally nosotros iterate on this exciting future. Send us feedback past times posting comments below, as well as delight file whatever bugs y'all encounter on AOSP.

We aspect forrad to a novel era of Android libraries!

Use Android Jetpack To Accelerate Your App Development

in this post).

In addition, your app tin run on diverse versions of the platform because Android Jetpack components are built to supply their functionality independent of whatever specific version, providing backwards compatibility.

Further, Android Jetpack is built roughly modern pattern practices similar separation of concerns together with testability every bit good every bit productivity features similar Kotlin integration. This makes it far easier for you lot to build robust, high lineament apps amongst less code. While the components of Android Jetpack are built to piece of work together, e.g. lifecycle awareness together with alive data, you lot don't lead hold to utilisation all of them -- you lot tin integrate the parts of Android Jetpack that solve your problems spell keeping the parts of your app that are already working great.

We know that these benefits are of import to you lot because of feedback similar this:

"We had been thinking of trying out MVVM inwards our code base. Android Architecture Components gave us an slowly template to implement it. And it's helped brand our code to a greater extent than testable every bit well; the mightiness to unit of measurement exam ViewModels has definitely increased code robustness."

-- Sumiran Pradhan, Sr. Engineer, Zillow

If you lot desire to acquire to a greater extent than close how companies are using Android Jetpack components, you lot tin read the developer stories on the Android Developer site.

And finally, every bit you lot tin run into from the Android Jetpack diagram above, today we're announcing novel components every bit well.

What's New

Android Jetpack comes amongst 5 novel components:

  • WorkManager alpha release
  • Navigation alpha release
  • Paging stable release
  • Slices alpha release
  • Android KTX (Kotlin Extensions) alpha release


WorkManager

The WorkMananager ingredient is a powerful novel library that provides a one-stop solution for constraint-based background jobs that necessitate guaranteed execution, replacing the necessitate to utilisation things similar jobs or SyncAdapters. WorkManager provides a simplified, modern API, the mightiness to piece of work on devices amongst or without Google Play Services, the mightiness to create graphs of work, together with the mightiness to inquiry the terra firma of your work. Early feedback is real encouraging but nosotros dearest to brand certain that your utilisation cases are covered, too. You tin run into what nosotros lead hold together with hence far together with supply feedback on our alpha on the WorkManager component.

Navigation

While activities are the organization provided entry points into your app's UI, their inflexibility when it comes to sharing information betwixt each other together with transitions has made them a less than ideal architecture for constructing your in-app navigation. Today nosotros are introducing the Navigation ingredient every bit a framework for structuring your in-app UI, amongst a focus on making a single-Activity app the preferred architecture. With out of the box back upward for Fragments, you lot acquire all of the Architecture Components benefits such every bit Lifecycle together with ViewModel spell allowing Navigation to handgrip the complexity of FragmentTransactions for you. Further, the Navigation ingredient allows you lot to declare transitions that nosotros handgrip for you, automatically builds the right Up together with Back behavior, includes amount back upward for deep links, together with provides helpers for connecting Navigation into the appropriate UI widgets, similar the navigation drawer together with bottom navigation. But that's non all! The Navigation Editor inwards Android Studio 3.2 allows you lot to run into together with handle your navigation properties visually:

The Navigation component is also inwards alpha together with we'd dearest your feedback.

Paging

Data presented inwards an app tin live large together with costly to load, together with hence it's of import to avoid downloading, creating, or presenting also much at once. The Paging component version 1.0.0 makes it slowly to charge together with introduce large information sets amongst fast, interplanetary space scrolling inwards your RecyclerView. It tin charge paged information from local storage, the network, or both, together with lets you lot define how your content gets loaded. It plant out of the box amongst Room, LiveData, together with RxJava.

Slices

And finally, to circular out the laid of novel features making their debut inwards Android Jetpack is the Slices component. H5N1 "slice" is a agency to surface your app's UI within of the Google Assistant every bit a consequence of a search:

You tin learn all close the Slices component together with how to integrate it into your app on the Android Developer website.

Android KTX

And lastly but non least, 1 destination of Android Jetpack takes wages of Kotlin linguistic communication features that brand you lot to a greater extent than productive. Android KTX lets you lot transform Kotlin code similar this:

view.viewTreeObserver.addOnPreDrawListener(   object : ViewTreeObserver.OnPreDrawListener {     override fun onPreDraw(): Boolean {       viewTreeObserver.removeOnPreDrawListener(this)       actionToBeTriggered()       render truthful     } }); 

into to a greater extent than concise Kotlin code similar the following:

view.doOnPreDraw { actionToBeTriggered() } 

This is merely the get-go stride inwards bringing Kotlin back upward to Android Jetpack components; our destination is to brand Android Jetpack smashing for Kotlin developers (and of course of teaching Java developers!).You tin read to a greater extent than close Android KTX on the Android Developer spider web site.

Getting Started

You tin acquire started amongst Android Jetpack at developer.android.com/jetpack. You'll uncovering docs together with videos for Android Jetpack, run into what's novel inwards Android Jetpack components, participate inwards the community together with give us feedback. We've also created a YouTube playlist devoted to Android Jetpack, together with hence you lot tin melody inwards for information close Android Jetpack, components, tools together with best practices.

Getting Started amongst Android Jetpack volition say you lot how to select the Android Jetpack components into your existing apps together with attention you lot acquire started amongst novel Android Jetpack apps. Android Studio 3.2 has smashing tooling back upward for Android Jetpack. For edifice novel apps, utilisation the Activity & Fragment+ViewData activity, which you lot tin acquire to from File | New | New Project inwards Android Studio:

What's Next

With Android Jetpack, we're taking the benefits of the Support Library together with the Architecture Components together with turning it upward a notch amongst novel components, Android Studio integration together with Kotlin support. And spell Android Jetpack provides the adjacent generation components, tools together with guidance to accelerate your Android development, we've got a lot to a greater extent than that nosotros desire to do together with nosotros desire your help. Please become to developer.android.com/jetpack together with permit us know what nosotros tin do to brand your sense edifice Android apps fifty-fifty better.

Monday, October 15, 2018

Google I/O 2018: What’S Novel Inwards Android


Posted By Stephanie Cuthbertson, Product Management Director, Android

As Android has grown exponentially over the past times x years, we've also seen our developer community grow dramatically. In countries similar China, India, too Brazil, the issue of developers using our IDE almost tripled - inwards simply 2 years. With such growth, nosotros experience an fifty-fifty greater responsibleness to invest inwards our developer experience. Guided past times your feedback, we've focused our efforts on making mobile evolution fast too easy, helping yous teach to a greater extent than users past times making apps radically smaller, too increasing engagement to maintain users coming back. We're also pretty excited to run into Android Things become to 1.0, creating novel opportunities for yous to develop - everything from major consumer devices, to cool remote command vehicles! As Day 1 of Google I/O kicks off, let's cause got a closer await at these major themes from the Developer Keynote:

Development: making mobile evolution fast too easy

  • Android Jetpack — Today, nosotros announced Android Jetpack, designed to accelerate your app development. Android Jetpack is the side past times side generation of Android components, bringing together the benefits of the Support Library -- backwards compatibility too immediate updates -- to a larger laid of components, making it quick too slow to create robust, high character apps. Android Jetpack manages activities similar background tasks, navigation, too lifecycle management, then yous tin eliminate boilerplate code too focus on what makes your app great. Android Jetpack is designed to run good amongst Kotlin, saving yous fifty-fifty to a greater extent than code amongst Android KTX. The novel Android Jetpack components released today include WorkManager, Paging, Navigation, too Slices.

  • Kotlin — Since announcing back upwards for Kotlin concluding year, the developer community has embraced the language. Most importantly, 95% of developers say us they are really happy amongst using Kotlin for their Android development. And, the to a greater extent than developers exercise it, the to a greater extent than that issue rises. The issue of Play Store apps using Kotlin grew 6x inwards the concluding year. 35% of pro developers exercise it, too that issue is growing each month. We are continuing to better the Kotlin developer experience across our libraries, tooling, runtime, documentation too training. Android KTX is launching today equally role of Android Jetpack to optimize the Kotlin developer experience. Tooling continues to better amongst Android Studio, Lint support, too R8 optimizations. We cause got fifty-fifty tuned the Android Runtime (ART) inwards Android P, then that apps built amongst Kotlin tin run faster. We cause got rolled out Kotlin code snippets inwards our official documentation, too are publishing a Kotlin version of the API reference documentation today. Earlier this week, nosotros launched a novel Kotlin Bootcamp on Udacity, which is a neat resources for developers who are novel to Kotlin. Lastly, nosotros similar a shot cause got a Kotlin specialization inwards the Google Developers Experts Program. If yous nevertheless haven't used Kotlin, I promise yous you give it a try.
  • Android Studio 3.2 CanaryAndroid Studio 3.2 features tools for Android Jetpack including a visual Navigation Editor too novel code refactoring tools. The canary unloose also includes create tools to create the novel Android App Bundle format, Snapshots inwards the Android Emulator for fast showtime time, novel R8 optimizer for smaller download too install app code size, a novel Energy Profiler to stair out app acquit on on battery life, too more. You tin download the latest version of Android Studio 3.2 from the canary channel download page.

Distribution: making apps radically smaller

 As Android has grown exponentially over the past times x years Google I/O 2018: What’s novel inwards Android
  • Android App Bundle & Google Play Dynamic Delivery — Introducing the novel app model for Android. Dramatically bring down app size amongst a novel publishing format—the Android App Bundle. In Android Studio, you'll similar a shot create an app bundle that contains everything your app needs for whatsoever device—all the languages, every device covert size, every hardware architecture. Then, when a user downloads your app, Google Play's novel Dynamic Delivery volition only deliver the code too resources matching the user's device. People run into a smaller install size on the Play Store, tin download your app to a greater extent than quickly, too relieve infinite on their devices.  As Android has grown exponentially over the past times x years Google I/O 2018: What’s novel inwards Android
    (Left) An example of all resources beingness delivered to a device via a legacy APK.
    (Right) An example of Dynamic Delivery serving simply what’s needed to a device.
  • Dynamic features via the Android App Bundle — The Android App Bundle also enables modularization then that yous tin deliver features on-demand, instead of during install. You tin create dynamic characteristic modules inwards the latest Android Studio canary release. Join our beta program to release them on Google Play.
  • Google Play Console — New features too reports inwards the Read most the improvements to the dashboard, statistics, Android vitals, pre-launch report, acquisition report, too subscriptions dashboard. You tin also upload, test, too release apps using our novel publishing format, the Android App Bundle.
  • Google Play Instant — After launching inwards beta at GDC, today nosotros announced that all game developers tin create instant apps too we're thrilled to welcome Universal App campaigns.

Engagement: bringing users dorsum to a greater extent than too more.


  • Slices Slices are UI templates that display a rich array of dynamic, too interactive content from your app, across Android too inside Google surfaces. Slices tin include live-data, scrolling content, inline actions, too deep-linking into your app then users tin practice everything from playing music to checking reservation updates. Slices tin also comprise interactive controls similar toggles too sliders. You tin get started edifice Slices today, too they volition start out appearing for users soon.
 As Android has grown exponentially over the past times x years Google I/O 2018: What’s novel inwards Android As Android has grown exponentially over the past times x years Google I/O 2018: What’s novel inwards Android As Android has grown exponentially over the past times x years Google I/O 2018: What’s novel inwards Android
  • Actions — Actions are a novel way to brand your app's capabilities too content to a greater extent than accessible, then that people tin easily teach to it at the correct moment. App Actions volition seem to users based on usage too relevance, across multiple Google too Android surfaces, such equally the Google Search App, the Play Store, the Google Assistant, too the Launcher. App Actions volition move available for all developers to assay soon, delight sign upwards here if you'd similar to move notified. You tin also select to create a Conversational Action equally a companion experience to your app. This plant on a multifariousness of Assistant-enabled devices, such equally speakers too smart displays. Both types of Actions exercise a novel mutual catalog of intents.
 As Android has grown exponentially over the past times x years Google I/O 2018: What’s novel inwards Android

Smarter devices: a powerful platform for IoT devices


  • Android Things 1.0 Assistant-enabled products powered past times Android Things.  As Android has grown exponentially over the past times x years Google I/O 2018: What’s novel inwards AndroidAndroid Things 1.0 this week. Four novel System-on-Modules (SoMs) are similar a shot supported on the platform amongst guaranteed long-term back upwards for 3 years too additional options for extended support, making it easier to become from prototypes to production. To brand production evolution to a greater extent than seamless than ever, the accompanying Android Things Console is also ready for production. It helps developers easily deal too update their devices amongst the latest stability fixes too safety updates provided past times Google.

To teach started amongst Android Things, see our developer site too the novel Community Hub to explore kits, sample code, community projects, too bring together Google's IoT Developers Community to remain updated. We introduced a express programme to partner amongst the Android Things squad for technical guidance too back upwards edifice your product. If your companionship is interested, sign upwards for our OEM Partner Program.
In add-on to all these novel developments, we're on the basis inwards over 140 countries, growing too expanding the developer community through programs such equally Women Techmakers too Google Developer Groups (GDGs). We're investing inwards preparation programs similar Google Developers Certification, edifice to a greater extent than courses through Udacity too other partners, to assist developers deepen their technical capability. Today, 225 Google Developers Agency Program members from 50 agencies inwards xv countries, are Android Certified. As role of our Google Developers Experts Program, nosotros also similar a shot cause got to a greater extent than than 90 Android Developer Experts some the basis actively supporting developers, start-ups too companies to create too launch innovative apps.
We also choke on to recognize the neat run from give app too game developers. This year, nosotros held our 3rd annual Google Play Awards. The nominees correspond some of the best experiences available on Android, amongst an emphasis on overall quality, potent design, technical performance, too innovation. Check out the winners too nominees.
During Google I/O, attendees too viewers cause got an chance to dive deep amongst 48 Android & Play breakout sessions. Thank yous for all your wonderful feedback, too delight maintain giving us your advice on where nosotros should become next.