[英]Visual Studio: Where can I edit the dependencies of my android app?
I'm right now at monetizing my app. 我现在正在通过我的应用获利。 In order to do this, I need to do the following:
为此,我需要执行以下操作:
Import the Mobile Ads SDK 导入移动广告SDK
Apps can import the Google Mobile Ads SDK with a gradle dependency. 应用可以导入具有gradle依赖关系的Google Mobile Ads SDK。 Open the app-level build.gradle file for your app, and look for a "dependencies" section.
打开您的应用程序的应用程序级别build.gradle文件,然后查找“依赖项”部分。
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:25.3.1'
compile com.google.android.gms:play-services-ads:10.2.4'
}
I can absolutely NOT find this page where I can edit the dependencies. 我绝对找不到可以编辑依赖项的页面。 Can anyone hint me towards the right direction?
谁能向我暗示正确的方向? THANKS :)
谢谢 :)
In Xamarin the dependencies need to be binded to C#. 在Xamarin中,依赖项需要绑定到C#。 Luckily you do not have do that on your own for the Android Support AppCompat v7 and Play Services Ads because there are nuget packages:
幸运的是,您没有针对Android支持AppCompat v7和Play Services Ads单独执行此操作,因为其中包含nuget软件包:
https://www.nuget.org/packages/Xamarin.GooglePlayServices.Ads/ https://www.nuget.org/packages/Xamarin.Android.Support.v7.AppCompat/ https://www.nuget.org/packages/Xamarin.GooglePlayServices.Ads/ https://www.nuget.org/packages/Xamarin.Android.Support.v7.AppCompat/
Just right click "References" in your Xamarin Android project and click "Manage NuGet Packages" and install the packages mentioned above or make use of the package manager console. 只需在Xamarin Android项目中右键单击“参考”,然后单击“管理NuGet程序包”并安装上述程序包或使用程序包管理器控制台即可。
Inside your App Module you can find build.gradle file there you can write your dependency as.
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.example.satyamanand.helloworld"
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:25.3.1'
testCompile 'junit:junit:4.12'
}
You can't find Gradle dependencies because you're not using Gradle, you're using xamarin which is not the same as native Android Development using Android Studio. 您找不到Gradle依赖项,因为您没有使用Gradle,而是使用xamarin,这与使用Android Studio的本机Android开发不同。
Looking at and Android Docs for this sort of thing will perhaps not be so useful. 在Android Docs中查找此类信息可能不会那么有用。
I suggest you look here at the Xamarin Google Play Services module , this should get you started in the right direction. 建议您在这里查看Xamarin Google Play服务模块 ,这应该可以帮助您正确地开始工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.