Google Mobile Ads SDK for Android 使用教程

Google Mobile Ads SDK for Android 使用教程

googleads-mobile-android-examples googleads-mobile-android googleads-mobile-android-examples 项目地址: https://gitcode.com/gh_mirrors/go/googleads-mobile-android-examples

1. 项目的目录结构及介绍

本项目目录结构如下:

googleads-mobile-android-examples/
├── .github/
│   └── workflows/
│       ├── java.yml
│       └── kotlin.yml
├── java/
│   ├── app/
│   │   ├── src/
│   │   │   ├── main/
│   │   │   │   ├── java/
│   │   │   │   ├── res/
│   │   │   │   └── AndroidManifest.xml
│   │   │   └── test/
│   │   └── build.gradle
│   └── build.gradle
├── kotlin/
│   ├── app/
│   │   ├── src/
│   │   │   ├── main/
│   │   │   │   ├── java/
│   │   │   │   ├── res/
│   │   │   │   └── AndroidManifest.xml
│   │   │   └── test/
│   │   └── build.gradle
│   └── build.gradle
├── LICENSE
├── README.md
  • .github/workflows/:存放GitHub Actions的工作流配置文件,用于自动化构建、测试等流程。
  • java/kotlin/:分别包含使用Java和Kotlin语言编写的示例应用程序。
    • app/:应用程序的根目录,包含源代码、资源文件、AndroidManifest.xml和构建配置。
      • src/:源代码目录,分为main/test/
        • main/:存放主要的源代码和资源文件。
          • java/:Java源代码目录。
          • res/:资源文件目录,如布局、图片、字符串资源等。
          • AndroidManifest.xml:应用程序的配置文件。
        • test/:测试代码目录。
      • build.gradle:构建配置文件,用于配置项目构建过程。

2. 项目的启动文件介绍

启动文件位于java/app/src/main/AndroidManifest.xml(对于Java项目)和kotlin/app/src/main/AndroidManifest.xml(对于Kotlin项目)。以下是启动Activity的配置示例:

<application
    ...
    <activity android:name=".MainActivity">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    ...
</application>

这段配置指定了MainActivity为应用程序的启动Activity,用户打开应用时会首先看到这个Activity。

3. 项目的配置文件介绍

构建配置文件build.gradle位于项目的根目录以及每个模块目录下,用于配置项目的构建过程。以下是项目根目录下的build.gradle文件的部分配置示例:

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath "com.android.tools.build:gradle:4.1.0"
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

这个文件配置了项目的依赖仓库和插件,以及一个清理构建目录的任务。

每个模块的build.gradle文件则用于配置特定模块的构建细节,例如应用程序的编译选项、依赖项等。

googleads-mobile-android-examples googleads-mobile-android googleads-mobile-android-examples 项目地址: https://gitcode.com/gh_mirrors/go/googleads-mobile-android-examples

创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

昌雅子Ethen

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值