SlideShare a Scribd company logo
1 of 27
Download to read offline
Tips to HelpYou Migrate
to Android Studio 3.0
3
After a long period of expectation, Android
Studio 3.0 is almost here.
After 7 alpha versions of Android Studio 2.4,
Google announced that changes are far too great
and they will be incorporated into Android Studio
3.0. And then 9 alphas later, the new and
improved Android Studio was born. So overall,
there are quite a few changes.
Before you start googling your way just to end up where you
started, I’ve assembled some tips that helped me get from a
project that compiled on Android Studio 2.3 to a project that
compiled on Android Studio 3.0.
BREAKING REPOSITORIES
Odds are Android Studio will refuse to compile because dependencies to Android
libraries are not found…Huh…?
Failed to resolve: com.android.support:multidex:1.0.2
This, for example, was the error I got.You might see it differently, with a
different support library perhaps, but the problem is still the same –
Android’s own dependencies are nowhere to be found. So, crazy as it may
seem, Android Studio needs you to fix its own libraries’ location.
This is because Android moved all of its
repositories from jcenter to its own
repository. And since Google is working
closely with Gradle, Gradle 4.0 has
introduced a shortcut to said repository.
Good thing Android Studio 3.0 forced
you to update to Gradle 4.1, so that new
shortcut is available.
Just go to your top level app build.gradle file and add the google shortcut:
buildscript {
repositories {
google()
jcenter()
}
}
allprojects {
repositories {
google()
jcenter()
}
}
If for some reason you don’t have the newest Gradle or the shortcut isn’t working for you,
you can simply put the full path yourself:
maven {
url 'https://maven.google.com'
}
IN A FLAVORDIMENSION
FAR FAR AWAY
Syncing your build.gradle file is about to fail for sure with the following error message:
Error:All flavors must now belong to a named flavor dimension.
Android Studio 3.0 introduces the concept of Flavor
Dimensions to help you combine different flavors to one
flavor.
Suppose you have an arsenal of apps, each pretty much doing the same but
having their own themes.You use a flavor for each theme, get different APKs
with different application ids and therefore upload different apps to the store.
But what do you do when you want to merge two themes
together?
Or add functionality to only a subset of themes?
Or create one base theme from which all can derive?
Well, you have flavor dimensions.
The most basic approach, just to get you up and synching in the new
environment, is to define a default flavor dimension –
flavorDimensions "foo"
productFlavors {
...
}
If you don’t do much else, each one of your existing flavors would
be assigned the one flavor dimension you gave and everything will
be as it was. So really, your only problem here is choosing the name
for your default flavor (so it should take you no more than a couple
of hours to resolve this issue 🙂 )
For future reference, the real fun begins when you define more than on flavor
dimension, for example:
flavorDimensions "foo", "bar"
productFlavors {
amazing {
dimension "foo"
}
awesome {
dimension "foo"
}
great {
dimension "bar"
}
}
In this case, while we have defined 3
product flavors, we have actually only
defined 2 – amazingGreat and
awesomeGreat. Their sources, resources
etc. are all combined giving precedence to
those combing from ‘foo’ dimension (since
it is mentioned first).
And just a quick note: Android Studio now also has missing
dimension strategies and matching fallbacks in order to
combine specific flavors from libraries (You can read more
about it in release notes here and here).
The idea behind this strategy is very variant-oriented – unless you
specify otherwise, app variants will only consume libraries’ matching
variants
(so if you’ve got an awesomeGreatDebug variant in a library it would
be taken only when compiling the awesomeGreatDebug app variant).
LETTHE DEPRECATION
WARNINGS BEGIN
You should be able to sync and even compile your project now. But you’ll still be faced with grave
warning that you build.gradle is using deprecated attributes. And it’s always best to resolve issues
while deprecated.
If this looks odd to you, then, well… it should. Using the compile
configuration under the dependencies closure (section) is pretty basic
Configuration ‘compile’ in project ‘:app’ is deprecated. Use ‘implementation’ instead.
dependencies { implementation 'com.google.android.gms:play-
services-ads:<version-number>' }
This is actually a Gradle change introduced in Gradle 3.4, but since the last mandatory Gradle
version was 3.3, it’s packed together with the headache of migrating to the newAndroid
Studio. It’s easy to fix, as the error itself tells you to use ‘implementation’ and indeed that will
work –
However, if you’re writing a library or an Instant App module / feature, this may not
be the way to go.!
The old compile configuration has been split
to two configurations – implementation and
api.
Technically speaking, the old compile is
much more similar to api.
The implementation configuration, the one
recommended in the error message, is
preferred.
Let’s say you add a mobile SDK or some other external library.Their
interfaces are not going to change, unless you upgrade to a new version.This
means that for all subsequent compilations shouldn’t care about the
implementation itself and therefore there’s no need to recompile these
dependencies every time.
You can therefore get a faster build.
Pay close attention when adding new mobile SDKs whose
integration guide hasn’t been updated yet! 99% of the
time the implementation configuration is what you need!
void someProjectMethod() {
Library2.someL2Method();
}
Assume you’re using internal libraries or modules.
Assume your project is dependent on a module called Library1 which in turn is
dependent on a module called Library2. And your code uses Library2, since it’s
internal, for example:
There’s a chance that you will change someL2Method at some point. Remove it, add
parameters, anything. In this case, your project compilations need to recompile Library2 all
over again if one of its interfaces / APIs has changed. In this case, you must use the api
configuration (equivalent to the old ‘compile’ configuration).
If you’re using the
apk configuration, it
has been renamed
to runtimeOnly
If you’re using the
provided configuration,
it has been renamed to
compileOnly
01 02
BUT THAT’S JUST THE BASICS
And of course…
Instant Apps SDK is
finally here.
These quick fixes should get you and your project through compiling regularly. But
your project may have even more complications:
Configuration for
annotation processing
has changed.
Plain JAR
dependencies are now
considered transitive
dependencies. It
shouldn’t have much
effect on most project.
The Jack toolchain is
now officially
deprecated. If you
were using it for Java
8 language features,
they are now freely
accessible.
01 02 03 04
To fix any or more of these changes
take a look at the official
documentation here.
Icons source: www.flaticon.com
Drop us a note to contact@safedk.com and
we will consider adding them!
in-app protection
Ask us anything over email or in the social.We are listening!
THANKYOU!
contact@safedk.com

More Related Content

Similar to 3 Tips to Help You Migrate to Android Studio 3.0

How do I - Use Include Source to debug native code - Trasnscript.pdf
How do I - Use Include Source to debug native code - Trasnscript.pdfHow do I - Use Include Source to debug native code - Trasnscript.pdf
How do I - Use Include Source to debug native code - Trasnscript.pdfShaiAlmog1
 
Workshop - The Little Pattern That Could.pdf
Workshop - The Little Pattern That Could.pdfWorkshop - The Little Pattern That Could.pdf
Workshop - The Little Pattern That Could.pdfTobiasGoeschel
 
How to Create a Custom WordPress Plugin
How to Create a Custom WordPress PluginHow to Create a Custom WordPress Plugin
How to Create a Custom WordPress PluginAndolasoft Inc
 
Announcing codepen support for flutter how that works for developers
Announcing codepen support for flutter how that works for developersAnnouncing codepen support for flutter how that works for developers
Announcing codepen support for flutter how that works for developersConcetto Labs
 
WordPress Plugin - Chameleon
WordPress Plugin - ChameleonWordPress Plugin - Chameleon
WordPress Plugin - ChameleonFahad Mahmood
 
How to add ar effects to an android app using vr face library
How to add ar effects to an android app using vr face library How to add ar effects to an android app using vr face library
How to add ar effects to an android app using vr face library Moon Technolabs Pvt. Ltd.
 
How can JAVA Performance tuning speed up applications.pdf
How can JAVA Performance tuning speed up applications.pdfHow can JAVA Performance tuning speed up applications.pdf
How can JAVA Performance tuning speed up applications.pdfMindfire LLC
 
Introduction to Composer for Drupal
Introduction to Composer for DrupalIntroduction to Composer for Drupal
Introduction to Composer for DrupalLuc Bézier
 
"Dude, where’s my boilerplate? ", Oleksii Makodzeba
"Dude, where’s my boilerplate? ", Oleksii Makodzeba"Dude, where’s my boilerplate? ", Oleksii Makodzeba
"Dude, where’s my boilerplate? ", Oleksii MakodzebaFwdays
 
PVS-Studio Has Finally Got to Boost
PVS-Studio Has Finally Got to BoostPVS-Studio Has Finally Got to Boost
PVS-Studio Has Finally Got to BoostAndrey Karpov
 
create_patch_file_v3a.pdf
create_patch_file_v3a.pdfcreate_patch_file_v3a.pdf
create_patch_file_v3a.pdfvilaylala
 
Android Study Jam - Info Session
Android Study Jam - Info SessionAndroid Study Jam - Info Session
Android Study Jam - Info SessionAITIKDANDAPAT
 
Exploring the Exciting Features of Spring Boot 3.1.pdf
Exploring the Exciting Features of Spring Boot 3.1.pdfExploring the Exciting Features of Spring Boot 3.1.pdf
Exploring the Exciting Features of Spring Boot 3.1.pdfInexture Solutions
 
Innovation Generation - The Mobile Meetup: Android Best Practices
Innovation Generation - The Mobile Meetup: Android Best PracticesInnovation Generation - The Mobile Meetup: Android Best Practices
Innovation Generation - The Mobile Meetup: Android Best PracticesSolstice Mobile Argentina
 
Jetpack compose session1 (1).pptx
Jetpack compose session1 (1).pptxJetpack compose session1 (1).pptx
Jetpack compose session1 (1).pptxShubhamJogdand8
 
Android study jams info session 2021 new GDSC GECBSP
Android study jams info session 2021 new GDSC GECBSPAndroid study jams info session 2021 new GDSC GECBSP
Android study jams info session 2021 new GDSC GECBSPDomendra Sahu
 
Why Design Patterns Are Important In Software Engineering
Why Design Patterns Are Important In Software EngineeringWhy Design Patterns Are Important In Software Engineering
Why Design Patterns Are Important In Software EngineeringProtelo, Inc.
 

Similar to 3 Tips to Help You Migrate to Android Studio 3.0 (20)

HealthyCodeMay2014
HealthyCodeMay2014HealthyCodeMay2014
HealthyCodeMay2014
 
How do I - Use Include Source to debug native code - Trasnscript.pdf
How do I - Use Include Source to debug native code - Trasnscript.pdfHow do I - Use Include Source to debug native code - Trasnscript.pdf
How do I - Use Include Source to debug native code - Trasnscript.pdf
 
Compose Camp 1.pdf
Compose Camp 1.pdfCompose Camp 1.pdf
Compose Camp 1.pdf
 
Workshop - The Little Pattern That Could.pdf
Workshop - The Little Pattern That Could.pdfWorkshop - The Little Pattern That Could.pdf
Workshop - The Little Pattern That Could.pdf
 
How to Create a Custom WordPress Plugin
How to Create a Custom WordPress PluginHow to Create a Custom WordPress Plugin
How to Create a Custom WordPress Plugin
 
Announcing codepen support for flutter how that works for developers
Announcing codepen support for flutter how that works for developersAnnouncing codepen support for flutter how that works for developers
Announcing codepen support for flutter how that works for developers
 
WordPress Plugin - Chameleon
WordPress Plugin - ChameleonWordPress Plugin - Chameleon
WordPress Plugin - Chameleon
 
Compose Camp 1.pdf
Compose Camp 1.pdfCompose Camp 1.pdf
Compose Camp 1.pdf
 
How to add ar effects to an android app using vr face library
How to add ar effects to an android app using vr face library How to add ar effects to an android app using vr face library
How to add ar effects to an android app using vr face library
 
How can JAVA Performance tuning speed up applications.pdf
How can JAVA Performance tuning speed up applications.pdfHow can JAVA Performance tuning speed up applications.pdf
How can JAVA Performance tuning speed up applications.pdf
 
Introduction to Composer for Drupal
Introduction to Composer for DrupalIntroduction to Composer for Drupal
Introduction to Composer for Drupal
 
"Dude, where’s my boilerplate? ", Oleksii Makodzeba
"Dude, where’s my boilerplate? ", Oleksii Makodzeba"Dude, where’s my boilerplate? ", Oleksii Makodzeba
"Dude, where’s my boilerplate? ", Oleksii Makodzeba
 
PVS-Studio Has Finally Got to Boost
PVS-Studio Has Finally Got to BoostPVS-Studio Has Finally Got to Boost
PVS-Studio Has Finally Got to Boost
 
create_patch_file_v3a.pdf
create_patch_file_v3a.pdfcreate_patch_file_v3a.pdf
create_patch_file_v3a.pdf
 
Android Study Jam - Info Session
Android Study Jam - Info SessionAndroid Study Jam - Info Session
Android Study Jam - Info Session
 
Exploring the Exciting Features of Spring Boot 3.1.pdf
Exploring the Exciting Features of Spring Boot 3.1.pdfExploring the Exciting Features of Spring Boot 3.1.pdf
Exploring the Exciting Features of Spring Boot 3.1.pdf
 
Innovation Generation - The Mobile Meetup: Android Best Practices
Innovation Generation - The Mobile Meetup: Android Best PracticesInnovation Generation - The Mobile Meetup: Android Best Practices
Innovation Generation - The Mobile Meetup: Android Best Practices
 
Jetpack compose session1 (1).pptx
Jetpack compose session1 (1).pptxJetpack compose session1 (1).pptx
Jetpack compose session1 (1).pptx
 
Android study jams info session 2021 new GDSC GECBSP
Android study jams info session 2021 new GDSC GECBSPAndroid study jams info session 2021 new GDSC GECBSP
Android study jams info session 2021 new GDSC GECBSP
 
Why Design Patterns Are Important In Software Engineering
Why Design Patterns Are Important In Software EngineeringWhy Design Patterns Are Important In Software Engineering
Why Design Patterns Are Important In Software Engineering
 

More from SafeDK

How to work compliantly with 3rd parties
How to work compliantly with 3rd partiesHow to work compliantly with 3rd parties
How to work compliantly with 3rd partiesSafeDK
 
Mobile Apps Competitive Analysis Done Right
Mobile Apps Competitive Analysis Done RightMobile Apps Competitive Analysis Done Right
Mobile Apps Competitive Analysis Done RightSafeDK
 
11 Top influencers in the mobile app development industry you just must follow
 11 Top influencers in the mobile app development industry you just must follow 11 Top influencers in the mobile app development industry you just must follow
11 Top influencers in the mobile app development industry you just must followSafeDK
 
What's New in Google Play's Developer's Policy
What's New in Google Play's Developer's PolicyWhat's New in Google Play's Developer's Policy
What's New in Google Play's Developer's PolicySafeDK
 
The Hitchhiker’s Guide to StackOverflow
The Hitchhiker’s Guide to StackOverflowThe Hitchhiker’s Guide to StackOverflow
The Hitchhiker’s Guide to StackOverflowSafeDK
 
Don’t Crash the Party: How to Ensure Your App’s Stability?
Don’t Crash the Party: How to Ensure Your App’s Stability?Don’t Crash the Party: How to Ensure Your App’s Stability?
Don’t Crash the Party: How to Ensure Your App’s Stability?SafeDK
 
Enough with the Mobile SDK Mess: A New Technology Is Born
Enough with the Mobile SDK Mess: A New Technology Is BornEnough with the Mobile SDK Mess: A New Technology Is Born
Enough with the Mobile SDK Mess: A New Technology Is BornSafeDK
 
Serious About Your App Marketing? Here Are Your Must Have SDKs
Serious About Your App Marketing? Here Are Your Must Have SDKsSerious About Your App Marketing? Here Are Your Must Have SDKs
Serious About Your App Marketing? Here Are Your Must Have SDKsSafeDK
 
Using SDKs? Here’s How They Could Slow Your App Start Time
Using SDKs? Here’s How They Could Slow Your App Start TimeUsing SDKs? Here’s How They Could Slow Your App Start Time
Using SDKs? Here’s How They Could Slow Your App Start TimeSafeDK
 
5 Steps in Choosing the Right 3rd Party Tools (SDKs) for your Mobile App
5 Steps in Choosing the Right 3rd Party Tools (SDKs) for your Mobile App5 Steps in Choosing the Right 3rd Party Tools (SDKs) for your Mobile App
5 Steps in Choosing the Right 3rd Party Tools (SDKs) for your Mobile AppSafeDK
 

More from SafeDK (10)

How to work compliantly with 3rd parties
How to work compliantly with 3rd partiesHow to work compliantly with 3rd parties
How to work compliantly with 3rd parties
 
Mobile Apps Competitive Analysis Done Right
Mobile Apps Competitive Analysis Done RightMobile Apps Competitive Analysis Done Right
Mobile Apps Competitive Analysis Done Right
 
11 Top influencers in the mobile app development industry you just must follow
 11 Top influencers in the mobile app development industry you just must follow 11 Top influencers in the mobile app development industry you just must follow
11 Top influencers in the mobile app development industry you just must follow
 
What's New in Google Play's Developer's Policy
What's New in Google Play's Developer's PolicyWhat's New in Google Play's Developer's Policy
What's New in Google Play's Developer's Policy
 
The Hitchhiker’s Guide to StackOverflow
The Hitchhiker’s Guide to StackOverflowThe Hitchhiker’s Guide to StackOverflow
The Hitchhiker’s Guide to StackOverflow
 
Don’t Crash the Party: How to Ensure Your App’s Stability?
Don’t Crash the Party: How to Ensure Your App’s Stability?Don’t Crash the Party: How to Ensure Your App’s Stability?
Don’t Crash the Party: How to Ensure Your App’s Stability?
 
Enough with the Mobile SDK Mess: A New Technology Is Born
Enough with the Mobile SDK Mess: A New Technology Is BornEnough with the Mobile SDK Mess: A New Technology Is Born
Enough with the Mobile SDK Mess: A New Technology Is Born
 
Serious About Your App Marketing? Here Are Your Must Have SDKs
Serious About Your App Marketing? Here Are Your Must Have SDKsSerious About Your App Marketing? Here Are Your Must Have SDKs
Serious About Your App Marketing? Here Are Your Must Have SDKs
 
Using SDKs? Here’s How They Could Slow Your App Start Time
Using SDKs? Here’s How They Could Slow Your App Start TimeUsing SDKs? Here’s How They Could Slow Your App Start Time
Using SDKs? Here’s How They Could Slow Your App Start Time
 
5 Steps in Choosing the Right 3rd Party Tools (SDKs) for your Mobile App
5 Steps in Choosing the Right 3rd Party Tools (SDKs) for your Mobile App5 Steps in Choosing the Right 3rd Party Tools (SDKs) for your Mobile App
5 Steps in Choosing the Right 3rd Party Tools (SDKs) for your Mobile App
 

Recently uploaded

Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Science&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfScience&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfjimielynbastida
 
Bluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfBluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfngoud9212
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentationphoebematthew05
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsHyundai Motor Group
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxnull - The Open Security Community
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 

Recently uploaded (20)

Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Science&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfScience&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdf
 
Bluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfBluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdf
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentation
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 

3 Tips to Help You Migrate to Android Studio 3.0

  • 1. Tips to HelpYou Migrate to Android Studio 3.0 3
  • 2. After a long period of expectation, Android Studio 3.0 is almost here. After 7 alpha versions of Android Studio 2.4, Google announced that changes are far too great and they will be incorporated into Android Studio 3.0. And then 9 alphas later, the new and improved Android Studio was born. So overall, there are quite a few changes.
  • 3. Before you start googling your way just to end up where you started, I’ve assembled some tips that helped me get from a project that compiled on Android Studio 2.3 to a project that compiled on Android Studio 3.0.
  • 5. Odds are Android Studio will refuse to compile because dependencies to Android libraries are not found…Huh…? Failed to resolve: com.android.support:multidex:1.0.2 This, for example, was the error I got.You might see it differently, with a different support library perhaps, but the problem is still the same – Android’s own dependencies are nowhere to be found. So, crazy as it may seem, Android Studio needs you to fix its own libraries’ location.
  • 6. This is because Android moved all of its repositories from jcenter to its own repository. And since Google is working closely with Gradle, Gradle 4.0 has introduced a shortcut to said repository. Good thing Android Studio 3.0 forced you to update to Gradle 4.1, so that new shortcut is available.
  • 7. Just go to your top level app build.gradle file and add the google shortcut: buildscript { repositories { google() jcenter() } } allprojects { repositories { google() jcenter() } }
  • 8. If for some reason you don’t have the newest Gradle or the shortcut isn’t working for you, you can simply put the full path yourself: maven { url 'https://maven.google.com' }
  • 10. Syncing your build.gradle file is about to fail for sure with the following error message: Error:All flavors must now belong to a named flavor dimension. Android Studio 3.0 introduces the concept of Flavor Dimensions to help you combine different flavors to one flavor.
  • 11. Suppose you have an arsenal of apps, each pretty much doing the same but having their own themes.You use a flavor for each theme, get different APKs with different application ids and therefore upload different apps to the store. But what do you do when you want to merge two themes together? Or add functionality to only a subset of themes? Or create one base theme from which all can derive? Well, you have flavor dimensions.
  • 12. The most basic approach, just to get you up and synching in the new environment, is to define a default flavor dimension – flavorDimensions "foo" productFlavors { ... }
  • 13. If you don’t do much else, each one of your existing flavors would be assigned the one flavor dimension you gave and everything will be as it was. So really, your only problem here is choosing the name for your default flavor (so it should take you no more than a couple of hours to resolve this issue 🙂 )
  • 14. For future reference, the real fun begins when you define more than on flavor dimension, for example: flavorDimensions "foo", "bar" productFlavors { amazing { dimension "foo" } awesome { dimension "foo" } great { dimension "bar" } }
  • 15. In this case, while we have defined 3 product flavors, we have actually only defined 2 – amazingGreat and awesomeGreat. Their sources, resources etc. are all combined giving precedence to those combing from ‘foo’ dimension (since it is mentioned first).
  • 16. And just a quick note: Android Studio now also has missing dimension strategies and matching fallbacks in order to combine specific flavors from libraries (You can read more about it in release notes here and here). The idea behind this strategy is very variant-oriented – unless you specify otherwise, app variants will only consume libraries’ matching variants (so if you’ve got an awesomeGreatDebug variant in a library it would be taken only when compiling the awesomeGreatDebug app variant).
  • 18. You should be able to sync and even compile your project now. But you’ll still be faced with grave warning that you build.gradle is using deprecated attributes. And it’s always best to resolve issues while deprecated. If this looks odd to you, then, well… it should. Using the compile configuration under the dependencies closure (section) is pretty basic Configuration ‘compile’ in project ‘:app’ is deprecated. Use ‘implementation’ instead.
  • 19. dependencies { implementation 'com.google.android.gms:play- services-ads:<version-number>' } This is actually a Gradle change introduced in Gradle 3.4, but since the last mandatory Gradle version was 3.3, it’s packed together with the headache of migrating to the newAndroid Studio. It’s easy to fix, as the error itself tells you to use ‘implementation’ and indeed that will work – However, if you’re writing a library or an Instant App module / feature, this may not be the way to go.!
  • 20. The old compile configuration has been split to two configurations – implementation and api. Technically speaking, the old compile is much more similar to api. The implementation configuration, the one recommended in the error message, is preferred.
  • 21. Let’s say you add a mobile SDK or some other external library.Their interfaces are not going to change, unless you upgrade to a new version.This means that for all subsequent compilations shouldn’t care about the implementation itself and therefore there’s no need to recompile these dependencies every time. You can therefore get a faster build.
  • 22. Pay close attention when adding new mobile SDKs whose integration guide hasn’t been updated yet! 99% of the time the implementation configuration is what you need! void someProjectMethod() { Library2.someL2Method(); } Assume you’re using internal libraries or modules. Assume your project is dependent on a module called Library1 which in turn is dependent on a module called Library2. And your code uses Library2, since it’s internal, for example:
  • 23. There’s a chance that you will change someL2Method at some point. Remove it, add parameters, anything. In this case, your project compilations need to recompile Library2 all over again if one of its interfaces / APIs has changed. In this case, you must use the api configuration (equivalent to the old ‘compile’ configuration). If you’re using the apk configuration, it has been renamed to runtimeOnly If you’re using the provided configuration, it has been renamed to compileOnly 01 02
  • 24. BUT THAT’S JUST THE BASICS
  • 25. And of course… Instant Apps SDK is finally here. These quick fixes should get you and your project through compiling regularly. But your project may have even more complications: Configuration for annotation processing has changed. Plain JAR dependencies are now considered transitive dependencies. It shouldn’t have much effect on most project. The Jack toolchain is now officially deprecated. If you were using it for Java 8 language features, they are now freely accessible. 01 02 03 04
  • 26. To fix any or more of these changes take a look at the official documentation here.
  • 27. Icons source: www.flaticon.com Drop us a note to contact@safedk.com and we will consider adding them! in-app protection Ask us anything over email or in the social.We are listening! THANKYOU! contact@safedk.com