If anyone could help me understand some things regarding Android Studio, it would be most enlightening.
如果有人能帮助我了解一些关于Android Studio的事情,那将是最有启发的。
So, I have switched from Eclipse to Android Studio around a month ago and so far have only been working on my migrated Apps. As such, I have been tinkering around with only the AndroidManifest.xml file as was customary in Eclipse.
所以,大约一个月前,我已经从Eclipse切换到Android Studio,到目前为止,我只开发了迁移的应用程序。因此,我一直在摆弄机器人清单。xml文件是Eclipse中常见的。
However, recently, I have started creating a new project for the sake of learning Android Studio's differences from Eclipse from ground up. Aside from the very irritating appcompat_v7 issues I have encountered, I'm also confused with some things regarding build.gradle.
然而,最近,我开始创建一个新项目,以便从底层学习Android Studio与Eclipse的不同之处。除了遇到非常烦人的appcompat_v7问题之外,我还对build.gradle方面的问题感到困惑。
Below is a gradle code block from an app created from Android Studio:
下面是一个从安卓工作室创建的应用程序的代码块:
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion '22.0.1'
defaultConfig {
applicationId "com.myapp"
minSdkVersion 15
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:support-v4:22.2.0'
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.android.support:mediarouter-v7:22.2.0'
}
On the other hand, below is a code block from build.gradle of a migrated Eclipse project:
另一方面,下面是来自build的代码块。迁移的Eclipse项目的等级:
apply plugin: 'android'
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
compile project(':google-play-services_lib')
}
android {
compileSdkVersion 21
buildToolsVersion '22.0.1'
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
// Move the tests to tests/java, tests/res, etc...
instrumentTest.setRoot('tests')
// Move the build types to build-types/<type>
// For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
// This moves them out of them default location under src/<type>/... which would
// conflict with src/ being used by the main source set.
// Adding new build types or product flavors should be accompanied
// by a similar customization.
debug.setRoot('build-types/debug')
release.setRoot('build-types/release')
}
}
Am I right in some of the assumptions I have taken from reading?
我从阅读中得到的一些假设是正确的吗?
-
compileSdkVersion - must always use the highest for maximum compatibility to newer phones?
编译dkversion -必须始终使用最高的版本才能与更新的手机兼容?
-
targetedSdkVersion - my own preference on the optimal run conditions of my app?
targetedSdkVersion——我对应用程序的最佳运行条件的偏好?
-
buildToolsVersion - I read this must ALWAYS be using the latest version. Can someone explain why?
buildToolsVersion——我读到过,它必须始终使用最新的版本。有人能解释一下为什么?
Now to my questions with regards to manifest vs gradle:
现在来回答我关于舱单和等级的问题:
-
Do compile & buildtools version have to be the same? Can they be different?
编译和构建工具版本必须相同吗?他们能是不同的吗?
-
If I have both an AndroidManifest.xml and a build.gradle, how does Android Studio know which to use for the compile,min,targeted,buildtools versions?
如果我同时有一个AndroidManifest。xml和构建。gradle, Android Studio如何知道编译,最小,有针对性的构建工具版本应该使用什么呢?
-
As an extension to question 1, what happens when there is a discrepancy between the 2 files (if someone forgot for some reason and decided to add stuff in one of them?)
作为问题1的扩展,当两个文件之间存在差异时(如果有人出于某种原因忘记并决定在其中一个文件中添加内容)会发生什么情况?
-
Since there are duplicate attributes between the 2, does this mean that starting with apps generated from Android Studio, I don't need to touch AndroidManifest.xml at all?
由于2之间有重复的属性,这是否意味着从Android Studio生成的应用程序开始,我不需要触摸Android manifest。xml呢?
What about the
<activity></activity>
so the app doesn't force close when it can't find the activity? Does build.gradle take care of that automatically? Or controlling orientation and other finer features (am I stuck with modifying only the java files on Android Studio?)那么
,当app找不到活动时,它不会强迫关闭吗?并构建。gradle会自动处理吗?或者是控制方向和其他更好的特性(我是否只能修改Android Studio上的java文件?) (if it doesn't, then having 2 files to control the app is kind of redundant and maybe they should have just stuck to AndroidManifest.xml?)
(如果没有的话,那么有两个文件来控制应用程序就有点多余了,或许他们应该坚持使用AndroidManifest.xml?)
Sorry for the long, maybe winding, questions but it really is quite confusing to me.
很抱歉这么长时间,可能是曲折的问题,但这真的让我很困惑。
Thanks in advance.
提前谢谢。
Update:
更新:
After reading What is Gradle in Android Studio? and http://developer.android.com/tools/studio/index.html, my new questions:
看完Android Studio中的什么是Gradle ?以及http://developer.android.com/tools/studio/index.html,我的新问题:
-
AndroidManifest.xml is still needed, build.gradle just overrides settings if it has the same attributes.
AndroidManifest。仍然需要xml构建。如果属性相同,gradle就会覆盖设置。
Question: So BOTH are still needed in Android Studio, correct?
问:所以在Android Studio中仍然需要两者,对吗?
-
compile & buildtools version DON'T have to be the same BUT buildtools must always be higher than compileSdkVersion.
编译和构建工具版本不必相同,但是构建工具必须始终高于compile dkversion。
Question: Is this because Google creates a new buildtools version for each new Sdk and the higher version are backward compatible? Therefore, higher buildtools will build lower compileSdkVersion while the reverse is not true, correct?
问题:这是因为谷歌为每个新的Sdk创建了一个新的构建工具版本,而更高版本是向后兼容的吗?因此,更高的构建工具将构建更低的编译dkversion,而反过来不是正确的,对吗?
3 个解决方案
#1
5
I will try to address as many questions as possible, but I will start by suggesting that you do not use the generated build.gradle from the eclipse migration. Create a new project in Android Studio and use the build.gradle that it generates as a template for what you should be using, ie copy it's contents to your real project and change the values that make sense. Spend the time understanding and getting the build.gradle right, it will save you time in the future. Also mimic the file structure of the new project as best you can. The great thing about gradle is that it (usually) gives you meaningful errors.
我将尽量解决尽可能多的问题,但是我首先建议您不要使用生成的构建。来自eclipse迁移的渐变。在Android Studio中创建一个新项目并使用这个构建。它作为你应该使用的模板生成,也就是将它的内容复制到你的真实项目中,并更改有意义的值。花时间理解并获得构建。对,这将为你将来节省时间。还要尽可能地模仿新项目的文件结构。关于渐变,最重要的是它(通常)会给你带来有意义的错误。
compileSdkVersion - must always use the highest for maximum compatibility to newer phones?
编译dkversion -必须始终使用最高的版本才能与更新的手机兼容?
targetedSdkVersion - my own preference on the optimal run conditions of my app?
targetedSdkVersion——我对应用程序的最佳运行条件的偏好?
compile and targeted should, in most cases, be the same. The compile value obviously tells the compiler which version to compile against and the target version tells the runtime which compatibility features to use. For example if you are targeting v21 and the app is running on a phone running v23, it will enable some compatibility features to enable your app to run a little nicer.
在大多数情况下,编译和目标应该是相同的。编译值显然告诉编译器要编译哪个版本,而目标版本告诉运行时要使用哪个兼容性特性。例如,如果你的目标是v21,而这个应用程序运行在一个运行v23的手机上,那么它就能让你的应用程序运行得更好。
buildToolsVersion - I read this must ALWAYS be using the latest version. Can someone explain why?
buildToolsVersion——我读到过,它必须始终使用最新的版本。有人能解释一下为什么?
The build tools you can think of as the compiler. If you have set compileSdkVersion 23, then you will need the 23.+ version of the build tools. But, to answer your question, let's say there was a bug with version 23.0 of the build tools (eg. it wasn't building native code properly) then Google would release 23.1 of the build tools. Now if your code doesn't compile native code, then the update doesn't really apply to you - you don't need it, but hey, it's always good to update incase you do. Moreover, if your compileSdkVersion is 23 and you have build tools version 24, well version 24 of the build tools is quite capable of building version 23.
您可以将构建工具视为编译器。如果您已经设置了compiler esdkversion 23,那么您将需要这个23。+构建工具的版本。但是,为了回答您的问题,假设有一个构建工具的23.0版本的bug(例如)。它没有正确地构建本机代码)然后谷歌将发布23.1个构建工具。如果您的代码没有编译本机代码,那么更新并不真正适用于您——您不需要它,但是,嘿,如果您需要更新,那么更新总是好的。此外,如果您的编译版本是23,并且您有构建工具版本24,那么版本24的构建工具非常有能力构建版本23。
Do compile & buildtools version have to be the same? Can they be different?
编译和构建工具版本必须相同吗?他们能是不同的吗?
Hopefully this is answered above, but the answer is yes they can be different, but the build tools major version must always be greater than the compileSdkVersion.
希望上面已经给出了答案,但是答案是肯定的,它们可以是不同的,但是构建工具的主要版本必须总是大于compile dkversion。
If I have both an AndroidManifest.xml and a build.gradle, how does Android Studio know which to use for the compile,min,targeted,buildtools versions?
如果我同时有一个AndroidManifest。xml和构建。gradle, Android Studio如何知道编译,最小,有针对性的构建工具版本应该使用什么呢?
As an extension to question 1, what happens when there is a discrepancy between the 2 files (if someone forgot for some reason and decided to add stuff in one of them?)
作为问题1的扩展,当两个文件之间存在差异时(如果有人出于某种原因忘记并决定在其中一个文件中添加内容)会发生什么情况?
The build.gradle will override values in the AndroidManifest.xml file, but to avoid confusion I would put all the above mentioned values into the build.gradle, and remove them from the manifest. That's where they belong. The build.gradle can do some really cool things, it can override values in the manifest and even merge two manifest files.
构建。渐变将覆盖AndroidManifest中的值。xml文件,但是为了避免混淆,我将上面提到的所有值放到构建中。葛拉德,把他们从舱单上拿掉。这就是他们的归宿。构建。gradle可以做一些很酷的事情,它可以覆盖manifest中的值,甚至可以合并两个manifest文件。
Since there are duplicate attributes between the 2, does this mean that starting with apps generated from Android Studio, I don't need to touch AndroidManifest.xml at all?
由于2之间有重复的属性,这是否意味着从Android Studio生成的应用程序开始,我不需要触摸Android manifest。xml呢?
What about the so the app doesn't force close when it can't find the activity? Does build.gradle take care of that automatically? Or controlling orientation and other finer features (am I stuck with modifying only the java files on Android Studio?)
那么当应用程序找不到活动时,它又会怎么做呢?并构建。gradle会自动处理吗?或者是控制方向和其他更好的特性(我是否只能修改Android Studio上的java文件?)
(if it doesn't, then having 2 files to control the app is kind of redundant and maybe they should have just stuck to AndroidManifest.xml?)
(如果没有的话,那么有两个文件来控制应用程序就有点多余了,或许他们应该坚持使用AndroidManifest.xml?)
Definitely not. It just means that you have to do some things in the build.gradle and some in the AndroidManifest.xml. For example, if you add an activity, you must edit the AndroidManifest.xml as usual. If you want to alter the properties of the activity (rotation, theme etc) this is also still done in the AndroidManifest.xml. If you want to start using a new library from Maven Central, you will have to add it to the build.gradle. If you want to change the keys you use to sign the app with when you make a release build, or change the versionName of your app: build.gradle. Basically the build.gradle gives you a higher degree of control over your builds, I really recommend checking out what you can do here: http://developer.android.com/tools/building/configuring-gradle.html
绝对不会。它只是意味着您必须在构建中做一些事情。gradle和一些android宣言。xml。例如,如果您添加一个活动,您必须编辑AndroidManifest。xml和往常一样。如果您想要更改活动的属性(旋转、主题等),这在AndroidManifest.xml中也是一样的。如果您想要开始使用Maven中心的新库,您必须将它添加到build.gradle中。如果你想要更改在发布构建时使用的按键,或者更改应用程序的版本名:build.gradle。基本构建。gradle为您提供了对构建的更高程度的控制,我建议您在这里检查一下:http://developer.android.com/tools/building/configuring-gradle.html
AndroidManifest.xml is still needed, build.gradle just overrides settings if it has the same attributes.
AndroidManifest。仍然需要xml构建。如果属性相同,gradle就会覆盖设置。
Question: So BOTH are still needed in Android Studio, correct?
问:所以在Android Studio中仍然需要两者,对吗?
Correct. You still need both.
正确的。你仍然需要。
compile & buildtools version DON'T have to be the same BUT buildtools must always be higher than compileSdkVersion.
编译和构建工具版本不必相同,但是构建工具必须始终高于compile dkversion。
Question: Is this because Google creates a new buildtools version for each new Sdk and the higher version are backward compatible? Therefore, higher buildtools will build lower compileSdkVersion while the reverse is not true, correct?
问题:这是因为谷歌为每个新的Sdk创建了一个新的构建工具版本,而更高版本是向后兼容的吗?因此,更高的构建工具将构建更低的编译dkversion,而反过来不是正确的,对吗?
Also correct!
也对!
#2
3
Android Manifest file is useful for Activity, Permissions required and Declaring Services in Android applications, but build.gradle useful for library declaration etc.
Android Manifest文件对于Android应用程序中的活动、所需的权限和声明服务非常有用,但是对于build非常有用。适用于图书馆申报等。
#3
1
Gradle VS Menifest as below... Gradle overrides the manifest values and I prefer to update build.gradle file in Android studio and menifest file in android eclipse. Gradle supports Application which can be controled via Android studio framework. version code, version name, target SDK and many other libs refrence. change or update by one click in Android Studio, after that we can build project and genrate new apk.
等级VS。Gradle覆盖清单值,我更喜欢更新构建。Android studio中的渐变文件和Android eclipse中的menifest文件。Gradle支持可以通过Android studio框架控制的应用。版本代码、版本名称、目标SDK和许多其他libs的局限性。在Android Studio中点击一下即可进行更改或更新,之后我们可以构建项目并生成新的apk。
For Android Studio:
为Android工作室:
apply plugin: 'com.android.application'
应用插件:“com.android.application”
android { compileSdkVersion 23 buildToolsVersion "23.0.3"
android{编译dkversion 23 buildToolsVersion“23.0.3”
defaultConfig {
applicationId "com.android.demo"
minSdkVersion 18
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
}
dependencies { compile fileTree(include: ['*.jar'], dir: 'libs') testCompile 'junit:junit:4.12' compile 'com.android.support:appcompat-v7:23.4.0' compile 'com.android.support:design:23.4.0' compile 'com.google.firebase:firebase-core:9.4.0' compile 'com.google.firebase:firebase-messaging:9.4.0' compile 'com.android.volley:volley:1.0.0' compile 'com.google.code.gson:gson:2.6.1'
依赖项{编译文件树(包括:['*。支持:appcompat-v7:23.4.0' compile 'com.android.support: compile . android4.0 ' compile 'com. androidis .support:design:23.4.0' compile 'com. googlebase:firebase:firebase-core:9.4.0' compile 'com. google.com .firebase:
} apply plugin: 'com.google.gms.google-services'
}应用插件:“com.google.gms.google-services”
For Android Eclipse:
Eclipse为Android:
`
”
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android = " http://schemas.android.com/apk/res/android "
package="com.android.app"
android:versionCode="1"
android:versionName="1.0" >`
#1
5
I will try to address as many questions as possible, but I will start by suggesting that you do not use the generated build.gradle from the eclipse migration. Create a new project in Android Studio and use the build.gradle that it generates as a template for what you should be using, ie copy it's contents to your real project and change the values that make sense. Spend the time understanding and getting the build.gradle right, it will save you time in the future. Also mimic the file structure of the new project as best you can. The great thing about gradle is that it (usually) gives you meaningful errors.
我将尽量解决尽可能多的问题,但是我首先建议您不要使用生成的构建。来自eclipse迁移的渐变。在Android Studio中创建一个新项目并使用这个构建。它作为你应该使用的模板生成,也就是将它的内容复制到你的真实项目中,并更改有意义的值。花时间理解并获得构建。对,这将为你将来节省时间。还要尽可能地模仿新项目的文件结构。关于渐变,最重要的是它(通常)会给你带来有意义的错误。
compileSdkVersion - must always use the highest for maximum compatibility to newer phones?
编译dkversion -必须始终使用最高的版本才能与更新的手机兼容?
targetedSdkVersion - my own preference on the optimal run conditions of my app?
targetedSdkVersion——我对应用程序的最佳运行条件的偏好?
compile and targeted should, in most cases, be the same. The compile value obviously tells the compiler which version to compile against and the target version tells the runtime which compatibility features to use. For example if you are targeting v21 and the app is running on a phone running v23, it will enable some compatibility features to enable your app to run a little nicer.
在大多数情况下,编译和目标应该是相同的。编译值显然告诉编译器要编译哪个版本,而目标版本告诉运行时要使用哪个兼容性特性。例如,如果你的目标是v21,而这个应用程序运行在一个运行v23的手机上,那么它就能让你的应用程序运行得更好。
buildToolsVersion - I read this must ALWAYS be using the latest version. Can someone explain why?
buildToolsVersion——我读到过,它必须始终使用最新的版本。有人能解释一下为什么?
The build tools you can think of as the compiler. If you have set compileSdkVersion 23, then you will need the 23.+ version of the build tools. But, to answer your question, let's say there was a bug with version 23.0 of the build tools (eg. it wasn't building native code properly) then Google would release 23.1 of the build tools. Now if your code doesn't compile native code, then the update doesn't really apply to you - you don't need it, but hey, it's always good to update incase you do. Moreover, if your compileSdkVersion is 23 and you have build tools version 24, well version 24 of the build tools is quite capable of building version 23.
您可以将构建工具视为编译器。如果您已经设置了compiler esdkversion 23,那么您将需要这个23。+构建工具的版本。但是,为了回答您的问题,假设有一个构建工具的23.0版本的bug(例如)。它没有正确地构建本机代码)然后谷歌将发布23.1个构建工具。如果您的代码没有编译本机代码,那么更新并不真正适用于您——您不需要它,但是,嘿,如果您需要更新,那么更新总是好的。此外,如果您的编译版本是23,并且您有构建工具版本24,那么版本24的构建工具非常有能力构建版本23。
Do compile & buildtools version have to be the same? Can they be different?
编译和构建工具版本必须相同吗?他们能是不同的吗?
Hopefully this is answered above, but the answer is yes they can be different, but the build tools major version must always be greater than the compileSdkVersion.
希望上面已经给出了答案,但是答案是肯定的,它们可以是不同的,但是构建工具的主要版本必须总是大于compile dkversion。
If I have both an AndroidManifest.xml and a build.gradle, how does Android Studio know which to use for the compile,min,targeted,buildtools versions?
如果我同时有一个AndroidManifest。xml和构建。gradle, Android Studio如何知道编译,最小,有针对性的构建工具版本应该使用什么呢?
As an extension to question 1, what happens when there is a discrepancy between the 2 files (if someone forgot for some reason and decided to add stuff in one of them?)
作为问题1的扩展,当两个文件之间存在差异时(如果有人出于某种原因忘记并决定在其中一个文件中添加内容)会发生什么情况?
The build.gradle will override values in the AndroidManifest.xml file, but to avoid confusion I would put all the above mentioned values into the build.gradle, and remove them from the manifest. That's where they belong. The build.gradle can do some really cool things, it can override values in the manifest and even merge two manifest files.
构建。渐变将覆盖AndroidManifest中的值。xml文件,但是为了避免混淆,我将上面提到的所有值放到构建中。葛拉德,把他们从舱单上拿掉。这就是他们的归宿。构建。gradle可以做一些很酷的事情,它可以覆盖manifest中的值,甚至可以合并两个manifest文件。
Since there are duplicate attributes between the 2, does this mean that starting with apps generated from Android Studio, I don't need to touch AndroidManifest.xml at all?
由于2之间有重复的属性,这是否意味着从Android Studio生成的应用程序开始,我不需要触摸Android manifest。xml呢?
What about the so the app doesn't force close when it can't find the activity? Does build.gradle take care of that automatically? Or controlling orientation and other finer features (am I stuck with modifying only the java files on Android Studio?)
那么当应用程序找不到活动时,它又会怎么做呢?并构建。gradle会自动处理吗?或者是控制方向和其他更好的特性(我是否只能修改Android Studio上的java文件?)
(if it doesn't, then having 2 files to control the app is kind of redundant and maybe they should have just stuck to AndroidManifest.xml?)
(如果没有的话,那么有两个文件来控制应用程序就有点多余了,或许他们应该坚持使用AndroidManifest.xml?)
Definitely not. It just means that you have to do some things in the build.gradle and some in the AndroidManifest.xml. For example, if you add an activity, you must edit the AndroidManifest.xml as usual. If you want to alter the properties of the activity (rotation, theme etc) this is also still done in the AndroidManifest.xml. If you want to start using a new library from Maven Central, you will have to add it to the build.gradle. If you want to change the keys you use to sign the app with when you make a release build, or change the versionName of your app: build.gradle. Basically the build.gradle gives you a higher degree of control over your builds, I really recommend checking out what you can do here: http://developer.android.com/tools/building/configuring-gradle.html
绝对不会。它只是意味着您必须在构建中做一些事情。gradle和一些android宣言。xml。例如,如果您添加一个活动,您必须编辑AndroidManifest。xml和往常一样。如果您想要更改活动的属性(旋转、主题等),这在AndroidManifest.xml中也是一样的。如果您想要开始使用Maven中心的新库,您必须将它添加到build.gradle中。如果你想要更改在发布构建时使用的按键,或者更改应用程序的版本名:build.gradle。基本构建。gradle为您提供了对构建的更高程度的控制,我建议您在这里检查一下:http://developer.android.com/tools/building/configuring-gradle.html
AndroidManifest.xml is still needed, build.gradle just overrides settings if it has the same attributes.
AndroidManifest。仍然需要xml构建。如果属性相同,gradle就会覆盖设置。
Question: So BOTH are still needed in Android Studio, correct?
问:所以在Android Studio中仍然需要两者,对吗?
Correct. You still need both.
正确的。你仍然需要。
compile & buildtools version DON'T have to be the same BUT buildtools must always be higher than compileSdkVersion.
编译和构建工具版本不必相同,但是构建工具必须始终高于compile dkversion。
Question: Is this because Google creates a new buildtools version for each new Sdk and the higher version are backward compatible? Therefore, higher buildtools will build lower compileSdkVersion while the reverse is not true, correct?
问题:这是因为谷歌为每个新的Sdk创建了一个新的构建工具版本,而更高版本是向后兼容的吗?因此,更高的构建工具将构建更低的编译dkversion,而反过来不是正确的,对吗?
Also correct!
也对!
#2
3
Android Manifest file is useful for Activity, Permissions required and Declaring Services in Android applications, but build.gradle useful for library declaration etc.
Android Manifest文件对于Android应用程序中的活动、所需的权限和声明服务非常有用,但是对于build非常有用。适用于图书馆申报等。
#3
1
Gradle VS Menifest as below... Gradle overrides the manifest values and I prefer to update build.gradle file in Android studio and menifest file in android eclipse. Gradle supports Application which can be controled via Android studio framework. version code, version name, target SDK and many other libs refrence. change or update by one click in Android Studio, after that we can build project and genrate new apk.
等级VS。Gradle覆盖清单值,我更喜欢更新构建。Android studio中的渐变文件和Android eclipse中的menifest文件。Gradle支持可以通过Android studio框架控制的应用。版本代码、版本名称、目标SDK和许多其他libs的局限性。在Android Studio中点击一下即可进行更改或更新,之后我们可以构建项目并生成新的apk。
For Android Studio:
为Android工作室:
apply plugin: 'com.android.application'
应用插件:“com.android.application”
android { compileSdkVersion 23 buildToolsVersion "23.0.3"
android{编译dkversion 23 buildToolsVersion“23.0.3”
defaultConfig {
applicationId "com.android.demo"
minSdkVersion 18
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
}
dependencies { compile fileTree(include: ['*.jar'], dir: 'libs') testCompile 'junit:junit:4.12' compile 'com.android.support:appcompat-v7:23.4.0' compile 'com.android.support:design:23.4.0' compile 'com.google.firebase:firebase-core:9.4.0' compile 'com.google.firebase:firebase-messaging:9.4.0' compile 'com.android.volley:volley:1.0.0' compile 'com.google.code.gson:gson:2.6.1'
依赖项{编译文件树(包括:['*。支持:appcompat-v7:23.4.0' compile 'com.android.support: compile . android4.0 ' compile 'com. androidis .support:design:23.4.0' compile 'com. googlebase:firebase:firebase-core:9.4.0' compile 'com. google.com .firebase:
} apply plugin: 'com.google.gms.google-services'
}应用插件:“com.google.gms.google-services”
For Android Eclipse:
Eclipse为Android:
`
”
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android = " http://schemas.android.com/apk/res/android "
package="com.android.app"
android:versionCode="1"
android:versionName="1.0" >`