Merhaba arkadaslar;
Her yeni yil Google kütüphanelerini yeniliyor.
gradle.properties dosyaniza su iki satiri ekleyin :
1 2 |
android.useAndroidX=true android.enableJetifier=true |
Proje düzeyinde build.gradle (Project: UygulamaAdi) dosyaniz su sekilde olmali :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
// Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { repositories { google() mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:7.2.1' classpath 'com.google.gms:google-services:4.3.10' classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.0' } } allprojects { repositories { google() mavenCentral() } } task clean(type: Delete) { delete rootProject.buildDir } |
Uygulama düzeyinde build.gradle (Module: UygulamaAdi.app) dosyaniz su sekilde olmali.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
apply plugin: 'com.android.application' android { compileSdkVersion 33 buildToolsVersion "33.0.0" defaultConfig { applicationId "com.paketadi.ornekuygulama" minSdkVersion 19 targetSdkVersion 33 versionCode 1 versionName "1.00" multiDexEnabled true testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } buildTypes { release { shrinkResources true minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } compileOptions { targetCompatibility JavaVersion.VERSION_11 sourceCompatibility JavaVersion.VERSION_11 } namespace 'com.paketadi.ornekuygulama' ndkVersion '24.0.8215888' } dependencies { implementation fileTree(dir: "libs", include: ["*.jar"]) // Android X implementation 'androidx.appcompat:appcompat:1.4.2' implementation 'androidx.constraintlayout:constraintlayout:2.1.4' implementation 'androidx.core:core:1.9.0-alpha05' implementation "com.google.android.gms:play-services-games-v2:+" // Google Play Game services implementation 'com.google.android.gms:play-services-location:19.0.1' implementation 'com.google.android.gms:play-services-ads:21.0.0' // Google Mobile Ads implementation 'com.google.android.gms:play-services-plus:17.0.0' // Google+ implementation 'com.google.android.gms:play-services-auth:20.2.0' // Google Account Login implementation 'com.google.android.gms:play-services-base:18.0.1' // Google Actions, Base Client Library implementation 'com.google.android.gms:play-services-identity:18.0.1' // Google Address API implementation 'com.google.android.gms:play-services-nearby:18.2.0' // Google Nearby // Firebase implementation platform('com.google.firebase:firebase-bom:30.1.0') implementation 'com.google.firebase:firebase-analytics' implementation 'com.google.firebase:firebase-crashlytics' testImplementation 'junit:junit:4.13.2' androidTestImplementation 'androidx.test.ext:junit:1.1.3' androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' } apply plugin: 'com.google.gms.google-services' apply plugin: 'com.google.firebase.crashlytics' |
Eger projenizde “FirebaseCrash” kullandiysaniz, bunu da degistirmeniz gerekiyor.
1 2 3 4 5 6 |
// Eski kullanim FirebaseCrash.logcat(Log.ERROR, getString(R.string.app_name), "Hata Mesaji."); FirebaseCrash.report(ex); // Yeni kullanim FirebaseCrashlytics.getInstance().log("Hata Mesaji"); |
Tabi Google Sign In icin kullandiginiz siniflarda degisti. Eskiden su sekilde tanimliyorduk;
1 2 3 4 5 6 7 |
//-----------------API Ayarı--------------------------------- mGoogleApiClient = new GoogleApiClient.Builder(this) .addConnectionCallbacks(this) .addOnConnectionFailedListener(this) .addApi(Games.API).addScope(Games.SCOPE_GAMES) .build(); //---------------------------------------------------------- |
Bu sınıf kullanımdan kaldırıldı. Bunun yerine
1 2 |
import com.google.android.gms.games.PlayGames; import com.google.android.gms.games.PlayGamesSdk; |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
// Google Play Games PlayGamesSdk.initialize(this); GamesSignInClient gamesSignInClient = PlayGames.getGamesSignInClient(this); gamesSignInClient.isAuthenticated().addOnCompleteListener(isAuthenticatedTask -> { boolean isAuthenticated = (isAuthenticatedTask.isSuccessful() && isAuthenticatedTask.getResult().isAuthenticated()); if (isAuthenticated) { Log.d(TAG, "isAuthenticated : true => Giriş zaten yapıldı !"); //... } else { // Play Games Hizmetleriyle entegrasyonunuzu devre dışı bırakın veya // oyunculardan oturum açmalarını istemek için bir oturum açma düğmesi gösterin. // Üzerine tıklamak, Oyun Oturum Açma İstemcisini çağırmalıdır. Log.e(TAG, "isAuthenticated : false => Oturum aciliyor.."); gamesSignInClient.signIn().addOnSuccessListener(this); } }); |
Ayrica
Bunun yerine
Android X | |
import android.support.v7.app.AppCompatActivity; | import androidx.appcompat.app.AppCompatActivity; |
dependencies | |
com.android.support.constraint:constraint-layout:2.0.4 | implementation ‘androidx.constraintlayout:constraintlayout:2.1.4’ |
Eski kod ;
1 2 3 4 5 6 7 8 |
// ----------------- Google AdSense --------------------- AdView adView = (AdView) this.findViewById(R.id.adView); AdRequest adRequest = new AdRequest.Builder() .addTestDevice("FDFBA5ED75827D63A746BF1B089E3E9B") .build(); if (adView != null) { adView.loadAd(adRequest); } |
Yeni Kod;