V1.0.1(2)接入MAX和Firebase

This commit is contained in:
lihongwei 2025-01-15 17:03:37 +08:00
parent 866500792a
commit b9f82e0bab
20 changed files with 620 additions and 223 deletions

View File

@ -4,14 +4,19 @@ import java.text.SimpleDateFormat
plugins {
id("com.android.application")
id("org.jetbrains.kotlin.android")
// id("com.google.gms.google-services")
// id("com.google.firebase.crashlytics")
id("com.google.gms.google-services")
id("com.google.firebase.crashlytics")
kotlin("kapt")
id ("kotlin-android")
id("applovin-quality-service")
}
applovin{
apiKey = "Ap3tAuLQUbET7lPATOvLHQkgWaKanmaE36A5H6NyBekZRdG0QZU2J0rCbRhpZqz8XffKhS6GRDom9XnQqSlhTA"
}
val timestamp = SimpleDateFormat("MM_dd_HH_mm").format(Date())
android {
namespace = "com.keyboard.bubble.skin.keyboard"
@ -22,8 +27,8 @@ android {
applicationId = "com.keyboard.bubble.skin"
minSdk = 23
targetSdk = 34
versionCode = 1
versionName = "1.0.0"
versionCode = 2
versionName = "1.0.1"
setProperty(
"archivesBaseName",
"Bubble Keyboard_V" + versionName + "(${versionCode})_$timestamp"
@ -81,69 +86,23 @@ dependencies {
implementation ("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.8.0")
implementation ("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.8.0")
// implementation(platform("com.google.firebase:firebase-bom:33.7.0"))
// implementation("com.google.firebase:firebase-crashlytics")
// implementation("com.google.firebase:firebase-analytics")
// implementation("com.google.firebase:firebase-config")
// Import the BoM for the Firebase platform
implementation(platform("com.google.firebase:firebase-bom:33.7.0"))
// Add the dependencies for the Crashlytics and Analytics libraries
// When using the BoM, you don't specify versions in Firebase library dependencies
implementation("com.google.firebase:firebase-crashlytics")
implementation("com.google.firebase:firebase-analytics")
implementation("com.google.firebase:firebase-config")
//-----------------------------------------------TopOn(pangle、IronSource、mintegral、unityads、liftoff(vungle)、Bigo)
//Anythink (Necessary)
// implementation("com.anythink.sdk:core-tpn:6.3.68")
// implementation("com.anythink.sdk:nativead-tpn:6.3.68")
// implementation("com.anythink.sdk:banner-tpn:6.3.68")
// implementation("com.anythink.sdk:interstitial-tpn:6.3.68")
// implementation("com.anythink.sdk:rewardedvideo-tpn:6.3.68")
// implementation("com.anythink.sdk:splash-tpn:6.3.68")
//
// //Androidx (Necessary)
// implementation("androidx.appcompat:appcompat:1.1.0")
// implementation("androidx.browser:browser:1.4.0")
//
// //Vungle
// implementation("com.anythink.sdk:adapter-tpn-vungle:6.3.68")
// implementation("com.vungle:vungle-ads:7.3.2")
// implementation("com.google.android.gms:play-services-basement:18.1.0")
// implementation("com.google.android.gms:play-services-ads-identifier:18.0.1")
//
// //UnityAds
// implementation("com.anythink.sdk:adapter-tpn-unityads:6.3.68")
// implementation("com.unity3d.ads:unity-ads:4.9.3")
//
// //Ironsource
// implementation("com.anythink.sdk:adapter-tpn-ironsource:6.3.68")
// implementation("com.ironsource.sdk:mediationsdk:8.1.0")
// implementation("com.google.android.gms:play-services-appset:16.0.2")
// implementation("com.google.android.gms:play-services-ads-identifier:18.0.1")
// implementation("com.google.android.gms:play-services-basement:18.1.0")
//
// //Bigo
// implementation("com.anythink.sdk:adapter-tpn-bigo:6.3.68")
// implementation("com.bigossp:bigo-ads:4.7.4")
//
// //Pangle
// implementation("com.anythink.sdk:adapter-tpn-pangle-nonchina:6.3.68.1")
// implementation( "com.pangle.global:ads-sdk:6.0.0.3")
// implementation( "com.google.android.gms:play-services-ads-identifier:18.0.1")
//
// //Mintegral
// implementation("com.anythink.sdk:adapter-tpn-mintegral-nonchina:6.3.68")
// implementation("com.mbridge.msdk.oversea:reward:16.7.51")
// implementation("com.mbridge.msdk.oversea:newinterstitial:16.7.51")
// implementation("com.mbridge.msdk.oversea:mbnative:16.7.51")
// implementation("com.mbridge.msdk.oversea:mbnativeadvanced:16.7.51")
// implementation("com.mbridge.msdk.oversea:mbsplash:16.7.51")
// implementation("com.mbridge.msdk.oversea:mbbanner:16.7.51")
// implementation("com.mbridge.msdk.oversea:mbbid:16.7.51")
// implementation("androidx.recyclerview:recyclerview:1.1.0")
//
// //Tramini
// implementation("com.anythink.sdk:tramini-plugin-tpn:6.3.68")
//
// // Debugger UI Tools
// implementation ("com.anythink.sdk:debugger-ui:1.0.7")
//--------------------------MAXLiftoff Monetizevungle、Mintegral、Pangle、Unity Ads
implementation("com.applovin:applovin-sdk:+")
implementation("com.applovin.mediation:vungle-adapter:+")
implementation("com.applovin.mediation:mintegral-adapter:+")
implementation("com.applovin.mediation:bytedance-adapter:+")
implementation("com.applovin.mediation:unityads-adapter:+")
//----------------------------------------------TopOn
}

29
app/google-services.json Normal file
View File

@ -0,0 +1,29 @@
{
"project_info": {
"project_number": "934262866767",
"project_id": "bubble-keyboard-d7fee",
"storage_bucket": "bubble-keyboard-d7fee.firebasestorage.app"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:934262866767:android:ef5ca43b451795d2283b3a",
"android_client_info": {
"package_name": "com.keyboard.bubble.skin"
}
},
"oauth_client": [],
"api_key": [
{
"current_key": "AIzaSyDzItPoLEY-QnElLT2Zv-QsZoFQocdt7Es"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": []
}
}
}
],
"configuration_version": "1"
}

View File

@ -43,3 +43,7 @@
-keep class com.omicronapplications.** { *; }
-keep class net.sf.sevenzipjbinding.** { *; }

View File

@ -1,7 +1,14 @@
package com.keyboard.bubble.skin.keyboard
import android.app.Application
import android.content.Intent
import android.graphics.Typeface
import android.util.Log
import androidx.localbroadcastmanager.content.LocalBroadcastManager
import com.applovin.sdk.AppLovinMediationProvider
import com.applovin.sdk.AppLovinSdk
import com.applovin.sdk.AppLovinSdkInitializationConfiguration
import com.google.firebase.FirebaseApp
import com.keyboard.bubble.skin.keyboard.bean.ParentBean
import com.keyboard.bubble.skin.keyboard.bean.ChildBean
//import com.pretty.keyboard.theme.keyboard.helper.ObjectBox
@ -22,15 +29,45 @@ class App : Application() {
var defaultFont: Typeface? = null
const val DB_VERSION = 1
const val DB_NAME = "db_name"
private const val MAX_SDK_KEY =
"3R_Opo3qdAFOciRXUG1wMgn3tWbv7SCl3649Glt_Q35HBLNBkRadTh3KBaDUZ0cvJXwcBg78Xa60W6UT1QN3l2"
var initSDkOK = false
var initAction = "SDK_INIT"
}
override fun onCreate() {
super.onCreate()
appInstance = this
// ObjectBox.init(this)
initMax()
defaultFont = Typeface.createFromAsset(assets, "my_font.ttf")
dealFile()
// //确保Firebase初始化
// FirebaseApp.initializeApp(this);
//
// // 输出日志以确认Firebase初始化
// if (FirebaseApp.getApps(this).isNotEmpty()) {
// Log.d(TAG, "Firebase 初始化成功1");
// } else {
// Log.e(TAG, "Firebase 初始化失败0");
// }
}
private fun initMax() {
val initConfig = AppLovinSdkInitializationConfiguration.builder(MAX_SDK_KEY, this)
.setMediationProvider(AppLovinMediationProvider.MAX)
.build()
// Initialize the SDK with the configuration
AppLovinSdk.getInstance(this).initialize(initConfig) {
initSDkOK = true
LocalBroadcastManager.getInstance(this@App)
.sendBroadcast(Intent(initAction))
}
}
private fun dealFile() {

View File

@ -32,7 +32,7 @@ class LikePage : Fragment() {
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
): View {
vb = LayoutLikeFragmentBinding.inflate(layoutInflater)
init()

View File

@ -0,0 +1,11 @@
package com.keyboard.bubble.skin.keyboard.max;
import com.applovin.mediation.MaxAd;
public interface MaxListener {
void onFail(MaxAd ad);
void onShowSuccess(MaxAd ad);
void onHidden();
}

View File

@ -0,0 +1,182 @@
package com.keyboard.bubble.skin.keyboard.max;
import android.app.Activity;
import android.util.Log;
import androidx.annotation.NonNull;
import com.applovin.mediation.MaxAd;
import com.applovin.mediation.MaxAdListener;
import com.applovin.mediation.MaxError;
import com.applovin.mediation.ads.MaxInterstitialAd;
import com.keyboard.bubble.skin.keyboard.App;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class MaxManager {
/**
Bubble_INST_Open
0f8e77fab9e26beb
Bubble_INST_Play
6547757725bafa0a
Bubble_INST_Setting
2ea60342addd3499
*/
private static final String one_AD = "0f8e77fab9e26beb";
private static final String two_Ad = "6547757725bafa0a";
private static final String three_ad = "2ea60342addd3499";
public static final int type_no_cache = 0;
public static final int type_has_cache = 1;
public static final int type_show_success = 2;
public static final int type_show_close = 3;
public static final int type_show_fail = 4;
private static List<MaxInterstitialAd> adList = new ArrayList<>();
public static MaxInterstitialAd getAd(List<MaxInterstitialAd> list) {
Collections.shuffle(list);
for (MaxInterstitialAd ad : list) {
if (ad.isReady()) {
return ad;
}
}
return null;
}
public static List<MaxInterstitialAd> onLoadAd() {
if (adList.isEmpty()) {
MaxInterstitialAd AdT = new MaxInterstitialAd(two_Ad, App.appInstance);
MaxInterstitialAd AdOne = new MaxInterstitialAd(one_AD, App.appInstance);
MaxInterstitialAd AdThree = new MaxInterstitialAd(three_ad, App.appInstance);
adList.add(AdOne);
adList.add(AdT);
adList.add(AdThree);
}
Log.d(App.TAG, "load");
for (MaxInterstitialAd ad : adList) {
if (!ad.isReady()) {
setMyListener(ad, new MaxListener() {
@Override
public void onFail(MaxAd ad) {
}
@Override
public void onShowSuccess(MaxAd ad) {
}
@Override
public void onHidden() {
}
});
ad.loadAd();
}
}
return adList;
}
public static void setMyListener(MaxInterstitialAd ad, MaxListener maxListener) {
ad.setListener(new MaxAdListener() {
@Override
public void onAdLoaded(@NonNull MaxAd maxAd) {
Log.d(App.TAG, "-------onAdLoaded-----maxAd=" + maxAd.getAdUnitId());
}
@Override
public void onAdDisplayed(@NonNull MaxAd maxAd) {
Log.d(App.TAG, "-------onAdDisplayed-----maxAd=" + maxAd.getAdUnitId());
maxListener.onShowSuccess(maxAd);
}
@Override
public void onAdHidden(@NonNull MaxAd maxAd) {
Log.d(App.TAG, "-------onAdHidden-----maxAd=" + maxAd.getAdUnitId());
maxListener.onHidden();
setMyListener(ad, new MaxListener() {
@Override
public void onFail(MaxAd ad) {
}
@Override
public void onShowSuccess(MaxAd ad) {
}
@Override
public void onHidden() {
}
});
ad.loadAd();
}
@Override
public void onAdClicked(@NonNull MaxAd maxAd) {
}
@Override
public void onAdLoadFailed(@NonNull String s, @NonNull MaxError maxError) {
Log.d(App.TAG, "-------onAdLoadFailed-----s=" + s+"----maxError="+maxError.getMessage() + "code="+maxError.getCode());
Log.d(App.TAG, "-------onAdLoadFailed-----s=" + s+"----getWaterfall="+maxError.getWaterfall());
}
@Override
public void onAdDisplayFailed(@NonNull MaxAd maxAd, @NonNull MaxError maxError) {
maxListener.onFail(maxAd);
}
});
}
protected static void ShowAd(Activity activity, onAdStatusListener listener) {
MaxInterstitialAd ad = MaxManager.getAd(adList);
if (ad == null) {
listener.onAdStatus(type_no_cache);
} else {
listener.onAdStatus(type_has_cache);
MaxManager.setMyListener(ad, new MaxListener() {
@Override
public void onFail(MaxAd ad) {
listener.onAdStatus(type_show_fail);
}
@Override
public void onShowSuccess(MaxAd ad) {
listener.onAdStatus(type_show_success);
}
@Override
public void onHidden() {
listener.onAdStatus(type_show_close);
}
});
ad.showAd(activity);
}
}
public static void startShowMaxAd(Activity activity, onAdAfterAction listener) {
MaxManager.ShowAd(activity, new onAdStatusListener() {
@Override
public void onAdStatus(int type) {
if (type == MaxManager.type_show_close || type == MaxManager.type_show_fail || type == MaxManager.type_no_cache) {
if (listener != null)
listener.onAction();
}
}
});
}
}

View File

@ -0,0 +1,51 @@
package com.keyboard.bubble.skin.keyboard.max
import android.app.Activity
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import android.content.IntentFilter
import android.os.CountDownTimer
import android.util.Log
import androidx.localbroadcastmanager.content.LocalBroadcastManager
import com.applovin.mediation.ads.MaxInterstitialAd
import com.keyboard.bubble.skin.keyboard.App
object WelComManager {
private lateinit var timer: CountDownTimer
private var need_Show = true
@JvmStatic
fun initTimer(activity: Activity, countTime: Long,countAction: (Long) -> Unit, goMainAction: () -> Unit): CountDownTimer {
need_Show = true
timer = object : CountDownTimer(countTime, 100) {
override fun onTick(millisUntilFinished: Long) {
countAction.invoke(millisUntilFinished)
if (need_Show) {
MaxManager.ShowAd(activity) {
Log.d(App.TAG, "--onTick----------it=$it")
if (it == MaxManager.type_has_cache) {
need_Show = false
}
if (it == MaxManager.type_show_close || it == MaxManager.type_show_fail) {
Log.d(App.TAG, "--onTick---------enter")
goMainAction.invoke()
}
}
}
}
override fun onFinish() {
if (need_Show) {
MaxManager.ShowAd(activity) {
goMainAction.invoke()
}
}
}
}
return timer
}
}

View File

@ -0,0 +1,6 @@
package com.keyboard.bubble.skin.keyboard.max;
public interface onAdAfterAction {
void onAction();
}

View File

@ -0,0 +1,6 @@
package com.keyboard.bubble.skin.keyboard.max;
public interface onAdStatusListener {
void onAdStatus(int type);
}

View File

@ -17,6 +17,7 @@ import com.keyboard.bubble.skin.keyboard.R;
import com.keyboard.bubble.skin.keyboard.databinding.ActivityMainBinding;
import com.keyboard.bubble.skin.keyboard.fagment.LikePage;
import com.keyboard.bubble.skin.keyboard.fagment.ViewPage;
import com.keyboard.bubble.skin.keyboard.max.MaxManager;
import com.keyboard.bubble.skin.keyboard.utils.MyUtils;
import java.util.ArrayList;
@ -38,7 +39,9 @@ public class MainActivity extends AppCompatActivity {
}
private void init() {
List<Fragment> listFragment = new ArrayList<>();
MaxManager.onLoadAd();
List<Fragment> listFragment = new ArrayList<>();
listFragment.add(ViewPage.newInstance());
listFragment.add(LikePage.newInstance());

View File

@ -26,6 +26,7 @@ import com.keyboard.bubble.skin.keyboard.R
import com.keyboard.bubble.skin.keyboard.bean.ChildBean
import com.keyboard.bubble.skin.keyboard.db.DbOpManager
import com.keyboard.bubble.skin.keyboard.fagment.EnablePage
import com.keyboard.bubble.skin.keyboard.max.MaxManager
import com.keyboard.bubble.skin.keyboard.myada.AdapterMain
import com.keyboard.bubble.skin.keyboard.mylistener.ItemClickCallback
import com.keyboard.bubble.skin.keyboard.mylistener.SetCallback
@ -89,6 +90,12 @@ class SetkeyboardActivity : AppCompatActivity() {
setContentView(R.layout.layout_apply)
MyUtils.initFullScreen(this)
MaxManager.onLoadAd()
MaxManager.startShowMaxAd(this@SetkeyboardActivity) {
}
findViewId()
getExtraData()
displayData()
@ -155,7 +162,9 @@ class SetkeyboardActivity : AppCompatActivity() {
private fun onClick() {
imgBack.setOnClickListener {
finish()
MaxManager.startShowMaxAd(this@SetkeyboardActivity){
finish()
}
}
imgLike.setOnClickListener {
@ -230,14 +239,15 @@ class SetkeyboardActivity : AppCompatActivity() {
private fun setApply() {
applyBtn.setOnClickListener {
val checkEnable = MyUtils.checkEnable(this)
val checkSetDefault = MyUtils.checkSetDefault(this)
if (!checkEnable || !checkSetDefault) {
showDialog()
return@setOnClickListener
MaxManager.startShowMaxAd(this@SetkeyboardActivity){
val checkEnable = MyUtils.checkEnable(this)
val checkSetDefault = MyUtils.checkSetDefault(this)
if (!checkEnable || !checkSetDefault) {
showDialog()
return@startShowMaxAd
}
startDown()
}
startDown()
}
}

View File

@ -20,6 +20,8 @@ import com.bumptech.glide.load.engine.GlideException;
import com.bumptech.glide.request.RequestListener;
import com.bumptech.glide.request.target.Target;
import com.keyboard.bubble.skin.keyboard.databinding.LayoutSuccessBinding;
import com.keyboard.bubble.skin.keyboard.max.MaxManager;
import com.keyboard.bubble.skin.keyboard.max.onAdAfterAction;
import com.keyboard.bubble.skin.keyboard.utils.MyUtils;
import com.keyboard.bubble.skin.keyboard.utils.ConstValue;
import com.keyboard.bubble.skin.keyboard.utils.SharedManager;
@ -47,6 +49,7 @@ public class SuccessPreViewActivity extends AppCompatActivity {
public void onInit() {
MaxManager.onLoadAd();
String stringExtra = getIntent().getStringExtra(key_name);
vb.title.setText(stringExtra);
@ -56,7 +59,12 @@ public class SuccessPreViewActivity extends AppCompatActivity {
vb.idBack.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
MaxManager.startShowMaxAd(SuccessPreViewActivity.this, new onAdAfterAction() {
@Override
public void onAction() {
finish();
}
});
}
});
if (curPath == null) {

View File

@ -6,40 +6,40 @@ import android.os.CountDownTimer
import android.widget.ProgressBar
import androidx.appcompat.app.AppCompatActivity
import com.keyboard.bubble.skin.keyboard.R
import com.keyboard.bubble.skin.keyboard.max.MaxManager
import com.keyboard.bubble.skin.keyboard.max.WelComManager
import com.keyboard.bubble.skin.keyboard.utils.MyUtils
import kotlin.math.roundToInt
class WelcomeActivity : AppCompatActivity() {
private lateinit var progressBar: ProgressBar
private var countTime = 1000L
private var countTime = 11000L
private lateinit var timer: CountDownTimer
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.layout_launch)
MyUtils.initFullScreen(this)
MaxManager.onLoadAd()
init()
findView()
}
private fun init() {
timer = object : CountDownTimer(countTime, 100) {
override fun onTick(millisUntilFinished: Long) {
val percentage: Float = 100 - millisUntilFinished.toFloat() / countTime * 100
val round = percentage.roundToInt()
progressBar.progress = round
}
timer = WelComManager.initTimer(this@WelcomeActivity, countTime, {
val percentage: Float = 100 - it.toFloat() / countTime * 100
val round = percentage.roundToInt()
progressBar.progress = round
}, {
progressBar.progress = 100
toHome()
})
override fun onFinish() {
progressBar.progress = 100
toHome()
}
}
timer.start()
}

View File

@ -1,8 +1,20 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id("com.android.application") version "8.1.0" apply false
id("com.android.application") version "8.8.0" apply false
id("org.jetbrains.kotlin.android") version "1.8.20" apply false
id("com.google.gms.google-services") version "4.4.2" apply false
id ("com.google.firebase.crashlytics") version "3.0.2" apply false
kotlin("kapt") version "2.0.0"
}
buildscript {
val agp_version by extra("8.8.0")
repositories {
maven { url = uri("https://artifacts.applovin.com/android") }
}
dependencies {
classpath ("com.applovin.quality:AppLovinQualityServiceGradlePlugin:+")
}
}

Binary file not shown.

View File

@ -1,6 +1,8 @@
#Thu Dec 21 17:14:29 CST 2023
#Wed Jan 15 14:26:13 CST 2025
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

297
gradlew vendored
View File

@ -1,7 +1,7 @@
#!/usr/bin/env sh
#!/bin/sh
#
# Copyright 2015 the original author or authors.
# Copyright © 2015-2021 the original authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -15,69 +15,104 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#
##############################################################################
##
## Gradle start up script for UN*X
##
#
# Gradle start up script for POSIX generated by Gradle.
#
# Important for running:
#
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
# noncompliant, but you have some other compliant shell such as ksh or
# bash, then to run this script, type that shell name before the whole
# command line, like:
#
# ksh Gradle
#
# Busybox and similar reduced shells will NOT work, because this script
# requires all of these POSIX shell features:
# * functions;
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
# * compound commands having a testable exit status, especially «case»;
# * various built-in commands including «command», «set», and «ulimit».
#
# Important for patching:
#
# (2) This script targets any POSIX shell, so it avoids extensions provided
# by Bash, Ksh, etc; in particular arrays are avoided.
#
# The "traditional" practice of packing multiple parameters into a
# space-separated string is a well documented source of bugs and security
# problems, so this is (mostly) avoided, by progressively accumulating
# options in "$@", and eventually passing that to Java.
#
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
# see the in-line comments for details.
#
# There are tweaks for specific operating systems such as AIX, CygWin,
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
#
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
app_path=$0
# Need this for daisy-chained symlinks.
while
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
[ -h "$app_path" ]
do
ls=$( ls -ld "$app_path" )
link=${ls#*' -> '}
case $link in #(
/*) app_path=$link ;; #(
*) app_path=$APP_HOME$link ;;
esac
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
' "$PWD" ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
MAX_FD=maximum
warn () {
echo "$*"
}
} >&2
die () {
echo
echo "$*"
echo
exit 1
}
} >&2
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
case "$( uname )" in #(
CYGWIN* ) cygwin=true ;; #(
Darwin* ) darwin=true ;; #(
MSYS* | MINGW* ) msys=true ;; #(
NONSTOP* ) nonstop=true ;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
@ -87,9 +122,9 @@ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
JAVACMD=$JAVA_HOME/jre/sh/java
else
JAVACMD="$JAVA_HOME/bin/java"
JAVACMD=$JAVA_HOME/bin/java
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
@ -98,88 +133,120 @@ Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
JAVACMD=java
if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=`expr $i + 1`
done
case $i in
0) set -- ;;
1) set -- "$args0" ;;
2) set -- "$args0" "$args1" ;;
3) set -- "$args0" "$args1" "$args2" ;;
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
fi
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=`save "$@"`
# Collect all arguments for the java command, stacking in reverse order:
# * args from the command line
# * the main class name
# * -classpath
# * -D...appname settings
# * --module-path (only if needed)
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
# For Cygwin or MSYS, switch paths to Windows format before running java
if "$cygwin" || "$msys" ; then
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
JAVACMD=$( cygpath --unix "$JAVACMD" )
# Now convert the arguments - kludge to limit ourselves to /bin/sh
for arg do
if
case $arg in #(
-*) false ;; # don't mess with options #(
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
[ -e "$t" ] ;; #(
*) false ;;
esac
then
arg=$( cygpath --path --ignore --mixed "$arg" )
fi
# Roll the args list around exactly as many times as the number of
# args, so each arg winds up back in the position where it started, but
# possibly modified.
#
# NB: a `for` loop captures its iteration list before it begins, so
# changing the positional parameters here affects neither the number of
# iterations, nor the values presented in `arg`.
shift # remove old arg
set -- "$@" "$arg" # push replacement arg
done
fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
org.gradle.wrapper.GradleWrapperMain \
"$@"
# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi
# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
#
# In Bash we could simply go:
#
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
# set -- "${ARGS[@]}" "$@"
#
# but POSIX shell has neither arrays nor command substitution, so instead we
# post-process each arg (as a line of input to sed) to backslash-escape any
# character that might be a shell metacharacter, then use eval to reverse
# that process (while maintaining the separation between arguments), and wrap
# the whole thing up as a single "set" statement.
#
# This will of course break if any of these variables contains a newline or
# an unmatched quote.
#
eval "set -- $(
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
xargs -n1 |
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
tr '\n' ' '
)" '"$@"'
exec "$JAVACMD" "$@"

37
gradlew.bat vendored
View File

@ -13,8 +13,10 @@
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@rem SPDX-License-Identifier: Apache-2.0
@rem
@if "%DEBUG%" == "" @echo off
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@ -25,7 +27,8 @@
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@ -40,13 +43,13 @@ if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute
if %ERRORLEVEL% equ 0 goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail
@ -56,11 +59,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail
@ -75,13 +78,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
if %ERRORLEVEL% equ 0 goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%
:mainEnd
if "%OS%"=="Windows_NT" endlocal

View File

@ -4,6 +4,8 @@ pluginManagement {
mavenCentral()
gradlePluginPortal()
maven { url = uri("https://artifacts.applovin.com/android") }
}
}
dependencyResolutionManagement {
@ -13,6 +15,9 @@ dependencyResolutionManagement {
mavenCentral()
maven("https://jitpack.io")
maven { url = uri("https://dl-maven-android.mintegral.com/repository/mbridge_android_sdk_oversea") }
maven { url = uri("https://artifact.bytedance.com/repository/pangle") }
}
}