In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly introduces the upgrade of Android studio2.3.3 to 3.1.2 pit, the article is very detailed, has a certain reference value, interested friends must read it!
1.grade configuration Error: Could not find com.android.tools.build:gradle:2.2.1.
The solution is a bit like the Maven warehouse: enter
D:\ software\ android\ android-studio-ide-145.3276617-windows\ android-studio\ gradle\ m2repository\ com\ android\ tools\ build\ gradle
Put the build.gradle file in the project
Dependencies {classpath 'com.android.tools.build:gradle:2.2.1'}
Change to
Dependencies {classpath 'com.android.tools.build:gradle:3.1.2'}
2.All flavors must now belong to a named flavor dimension.
You can solve the problem by adding a line of code to the build.gradle under module:
Android {... FlavorDimensions "versionCode"...}
3. Upgrade to Android Studio 3.1, rebuild the project Times error, the main errors are:
The SourceSet 'instrumentTest' is not recognized by the Android Gradle Plugin. Perhaps you misspelled something?
InstrumentTest is obsolete and the new Gradle plug-in is no longer supported. InstrumentTest needs to be changed to androidTest.
After modification, the relevant contents of sourceSets are similar:
Android {buildToolsVersion "27.0.3" compileSdkVersion 24 sourceSets {main {manifest.srcFile 'AndroidManifest.xml' java.srcDirs = [' src'] aidl.srcDirs = ['src'] renderscript.srcDirs = [' src'] res.srcDirs = ['res'] assets.srcDirs = [' assets'] jniLibs.srcDirs = ['libs']} androidTest.setRoot (' tests')}}
4. AAPT2 compiler error AAPT2 error
Error
Error:java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
Solution: turn off APPT2 compilation in gradle.properties
Android.enableAapt2=false
Note: if the project is transferred from eclipse to as, there may be no gradle.properties file, please create it manually in the project root directory
5. After upgrading Android Stadio 3.1,
After changing all compile to implementation, neither clean nor rebuild found an error, except that the following error occurred during run:
Causes and solutions
Reason: in accordance with the requirements of android stadio 3.1, you need to upgrade the gradle version to 4.4 or above, but gradle 4.4 and above require that compile that depends on api be replaced with implementation. The dependency declared by implementation cannot be passed beyond module, that is, outside that module, module cannot refer to the api declared by implementation.
That is, module An implementation libA, and moduleB implementation module A, then moduleB boots the api in libA, otherwise it will report org.gradle.api.internal.tasks.compile.CompilationFailedException in build.
Solution: replace compile with api, that is, if there are external references, replace it with: api, and the rest with: implementation.
Example:
Dependencies {api fileTree (dir: 'libs', include: [' * .jar']) testImplementation 'junit:junit:4.12' api' com.android.support:support-v4:26.1.0' api 'com.android.support:appcompat-v7:26.1.0' api' com.google.code.gson:gson:2.8.2' api 'com.j256.ormlite:ormlite-core:4.48' api' com.j256.ormlite:ormlite-android:4.48'
Ps: solution:
Android 6.0 (api 23) no longer supports HttpClient. Just add useLibrary 'org.apache.http.legacy' to build.gradle, as shown in the figure:
Error: (633,16) error: symbol not found: method sqrt (float) location: class FloatMath
Solution
The reason is that Android6.0 no longer supports FloatMath.sin (), and there are two main ways to solve it.
Method 1:
Compile with a version of SDK below 23. Set the compileSdkVersion in the gradle.build file (including project's gradle.build and module's gradle.build) to below 23.
Method 2:
Replace the FloatMath class with the Math class, Math.sin ()
Method 3:
(float) Math.sqrt replaces FloatMath.sqrt
The above is all the contents of the article "what are the pits in Android studio2.3.3 upgrade to 3.1.2?" Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.