Android Studio experience and android experience
I have sorted out some common problems encountered during this period and hope to help you... Click like if you find it useful.
Question 1:
Error :( 26, 9) Attribute application @ icon value = (@ drawable/logo) from AndroidManifest. xml: 26: 9
Error :( 28, 9) Attribute application @ theme value = (@ style/ThemeActionBar) from AndroidManifest. xml: 28: 9
Is also present at XXXX-trunk: XXXXLib: unspecified: 15: 9 value = (@ style/AppTheme)
Suggestion: add'tools: replace = "android: theme" 'to <application> element at AndroidManifest. xml: 24: 5 to override
Error: Execution failed for task': XXXX: processDebugManifest '.
> Manifest merger failed with multiple errors, see logs
Cause:
By default, the AS Gradle plug-in enables Manifest Merger Tool. If the same attributes AS the main project are defined in the Library project (for example, the default android: icon and android: theme ), in this case, the merge operation fails and an error is reported.
There are two solutions:
Method 1: In Manifest. add tools: replace = "android: icon, android: theme" under the application tag of xml (multiple attributes are separated by commas, and remember to add xmlns to the root tag of manifest: tools = "http://schemas.android.com/tools", otherwise namespace cannot be found)
Method 2: Add useOldManifestMerger true to the build. gradle root tag (lazy method)
Refer to official introduction:
Http://tools.android.com/tech-docs/new-build-system/user-guide/manifest-merger
Question 2:
BuildConfig. DEBUG in the Library Project is always false. This is a known issue of Android Studio. A Google attacker said that Library projects only generate release packages currently.
Issue 52962: https://code.google.com/p/android/issues/detail? Id = 52962
Solution:(Recommended method for a Google siege Lion)
Workaround: instaed of BuildConfig. DEBUG create another boolean variable at lib-project's e.g. BuildConfig. RELEASE and link it with application's buildType.
Https://gist.github.com/almozavr/d59e770d2a6386061fcb
Refer to stackoverflowThis post on:
Http://stackoverflow.com/questions/20176284/buildconfig-debug-always-false-when-building-library-projects-with-gradle
Question 3:
When each row is saved, extra spaces and tabs are automatically deleted (for example, unnecessary spaces at the end, empty rows, or tabs)
Especially every time you prepare to submit SVN and Review the code, you will suffer a lot of irrelevant changes.
Solution:
Settings-> IDE Settings-> Editor-> Other-> Strip trailing spaces on Save-> None
Question 4:
When compiling, the following error is reported: Failure [INSTALL_FAILED_OLDER_SDK]. Generally, the system automatically sets compileSdkVersion for you.
Solution:
Modify compileSdkVersion 'android-l' under build. gradle to compileSdkVersion 19 (or your local SDK)
Android studio usage
First, go to the bin directory of Android Studio and modify studio. bat Line 3 GOTO end adds PAUSE to view the error message before it. Enter cmd and point to the Android Studio directory to run studio. bat can view the error message and modify the studio.exe under the android-studio \ bindirectory. vmoptions-XX: + UseCodeCacheFlushing for removing 5th rows, started successfully
Use NotePad to open studio. bat under the android-studio \ bin directory
SET VM_OPTIONS_FILE = % IDE_BIN_DIR % \ studio=bits=.exe. vmoptions
SETVM_OPTIONS_FILE = % IDE_BIN_DIR % \ studio1_bits0000.exe started successfully [8]
Open with a text Tool
Studio. bat
Line25 to line 28:
Set jre = % JDK %
If exist "% JRE % \ jre" set jre = % JDK % \ jre
Set bits = if exist "% JRE % \ lib \ amd64" set bits = 64
We can see that the number of system bits supported by the software is 64 bits. If your computer is a 32-bit jre/lib directory with only i386 files, try
If exist "% JRE % \ lib \ amd64" set bits = 64
If exist "% JRE % \ lib \ i386" set bits = 32 [8]
Check whether the jdk path is configured. Neither 1.6 nor 1.7 is correct. Make sure that the jdk environment variable configuration is correct.
Android Studio cannot be enabled
1. When a project is created for the first time, something needs to be downloaded. If some errors are prompted, check the error and open the download again to run it. It may be that the download was not completely downloaded.
2. Check whether the jdk path is configured. There is no problem in both 1.6 and 1.7.
3. run Windows 7 as an administrator.
4. Find studio.exe. vmoptions in the bindirectory and remove the line containing UseCodeCacheFlushing.
5
Use NotePad to open studio. bat under the android-studio \ bin directory
SET VM_OPTIONS_FILE = % IDE_BIN_DIR % \ studio=bits=.exe. vmoptions
SET VM_OPTIONS_FILE = % IDE_BIN_DIR % \ studio1_bits0000.exe
You can use it.
6 open it with a text Tool
Studio. bat
Line25 to line 28:
Set jre = % JDK %
If exist "% JRE % \ jre" set jre = % JDK % \ jre
Set bits =
If exist "% JRE % \ lib \ amd64" set bits = 64
We can see that the number of system bits supported by the software is 64 bits, and my own computer is a 32-bit jre/lib directory with only i386 files.
Try
If exist "% JRE % \ lib \ amd64" set bits = 64
If exist "% JRE % \ lib \ i386" set bits = 32
Reference address: my.eoe.cn/..ondesknew