فهرست منبع

提交3.8.6构建安卓项目

mojunshou 8 ماه پیش
والد
کامیت
4cce4ea8c8

+ 14 - 40
native/engine/android/app/AndroidManifest.xml

@@ -1,42 +1,16 @@
 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:tools="http://schemas.android.com/tools"
-    android:installLocation="auto">
-
-    <uses-permission android:name="android.permission.INTERNET" />
-    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
-    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
-
-    <application
-        android:name="com.cocos.game.GameApp"
-        android:allowBackup="false"
-        android:extractNativeLibs="true"
-        android:icon="@mipmap/ic_launcher"
-        android:label="@string/app_name"
-        android:resizeableActivity="true"
-        android:usesCleartextTraffic="true"
-        tools:replace="android:allowBackup">
-        <meta-data
-            android:name="android.app.lib_name"
-            android:value="cocos" />
-
-        <activity
-            android:name="com.cocos.game.AppActivity"
-            android:configChanges="orientation|keyboardHidden|screenSize|screenLayout|smallestScreenSize"
-            android:exported="true"
-            android:label="@string/app_name"
-            android:launchMode="singleTask"
-            android:screenOrientation="portrait"
-            android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
-            <intent-filter>
-                <action android:name="android.intent.action.MAIN" />
-                <category android:name="android.intent.category.LAUNCHER" />
-            </intent-filter>
-        </activity>
-        <activity
-            android:name="com.cocos.lib.CocosEditBoxActivity"
-            android:configChanges="orientation|keyboardHidden|screenSize|screenLayout|smallestScreenSize"
-            android:screenOrientation="behind"
-            android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" />
-    </application>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="auto">
+  <uses-permission android:name="android.permission.INTERNET"/>
+  <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
+  <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
+  <application android:extractNativeLibs="true" android:allowBackup="true" android:label="@string/app_name" android:usesCleartextTraffic="true" android:icon="@mipmap/ic_launcher" android:resizeableActivity="true">
+    <meta-data android:name="android.app.lib_name" android:value="cocos"/>
+    <activity android:name="com.cocos.game.AppActivity" android:screenOrientation="portrait" android:configChanges="orientation|keyboardHidden|screenSize|screenLayout|smallestScreenSize" android:label="@string/app_name" android:theme="@android:style/Theme.NoTitleBar.Fullscreen" android:launchMode="singleTask" android:exported="true">
+      <intent-filter>
+        <action android:name="android.intent.action.MAIN"/>
+        <category android:name="android.intent.category.LAUNCHER"/>
+      </intent-filter>
+    </activity>
+    <activity android:name="com.cocos.lib.CocosEditBoxActivity" android:configChanges="orientation|keyboardHidden|screenSize|screenLayout|smallestScreenSize" android:screenOrientation="behind" android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen"/>
+  </application>
 </manifest>

+ 8 - 25
native/engine/android/app/build.gradle

@@ -1,3 +1,5 @@
+import org.apache.tools.ant.taskdefs.condition.Os
+
 apply plugin: 'com.android.application'
 
 RES_PATH = RES_PATH.replace("\\", "/")
@@ -8,7 +10,7 @@ android {
     compileSdkVersion PROP_COMPILE_SDK_VERSION.toInteger()
     buildToolsVersion PROP_BUILD_TOOLS_VERSION
     ndkPath PROP_NDK_PATH
-    namespace NAME_SPACE
+    namespace APPLICATION_ID
 
     compileOptions {
         sourceCompatibility JavaVersion.VERSION_1_8
@@ -20,7 +22,7 @@ android {
         minSdkVersion PROP_MIN_SDK_VERSION
         targetSdkVersion PROP_TARGET_SDK_VERSION
         versionCode 1
-        versionName "1.0.0"
+        versionName "1.0"
 
         externalNativeBuild {
             cmake {
@@ -53,7 +55,7 @@ android {
 
     signingConfigs {
 
-        release {
+       release {
             if (project.hasProperty("RELEASE_STORE_FILE") && !RELEASE_STORE_FILE.isEmpty()) {
                 storeFile file(RELEASE_STORE_FILE)
                 storePassword RELEASE_STORE_PASSWORD
@@ -74,7 +76,7 @@ android {
             if (project.hasProperty("RELEASE_STORE_FILE")) {
                 signingConfig signingConfigs.release
             }
-
+                        
             externalNativeBuild {
                 cmake {
                     // switch HIDE_SYMBOLS to OFF to skip compilation flag `-fvisibility=hidden`
@@ -86,9 +88,6 @@ android {
                 getIsDefault().set(true)
             }
 
-            buildConfigField "String", "ATMOB_CENTRAL_APP_KEY", "\"$atmob_central_app_key\""
-            buildConfigField "String", "GRAVITY_ACCESS_TOKEN", "\"$gravity_access_token\""
-            buildConfigField "String", "TEST_CHANNEL", "\"$test_channel\""
         }
 
         debug {
@@ -97,28 +96,13 @@ android {
             renderscriptDebuggable true
             // resValue  "string", "app_name", "${PROP_APP_NAME}-dbg"
             // applicationIdSuffix ".debug"
-
-            buildConfigField "String", "ATMOB_CENTRAL_APP_KEY", "\"$atmob_central_app_key\""
-            buildConfigField "String", "GRAVITY_ACCESS_TOKEN", "\"$gravity_access_token\""
-            buildConfigField "String", "TEST_CHANNEL", "\"$test_channel\""
-        }
-    }
-
-    buildFeatures {
-        buildConfig = true
-    }
-
-    configurations.configureEach {
-        resolutionStrategy {
-            // don't cache changing modules at all
-            cacheChangingModulesFor 10, 'seconds'
         }
     }
 }
 
 dependencies {
-    implementation fileTree(dir: '../libs', include: ['*.jar', '*.aar'])
-    implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
+    implementation fileTree(dir: '../libs', include: ['*.jar','*.aar'])
+    implementation fileTree(dir: 'libs', include: ['*.jar','*.aar'])
     implementation fileTree(dir: "${COCOS_ENGINE_PATH}/cocos/platform/android/java/libs", include: ['*.jar'])
     implementation project(':libservice')
     implementation project(':libcocos')
@@ -126,5 +110,4 @@ dependencies {
         implementation 'com.google.android.libraries.play.games:inputmapping:1.1.0-beta'
         implementation "org.jetbrains.kotlin:kotlin-stdlib:1.4.10"
     }
-    implementation "atmob.central:cocos-bridge:0.0.1-SNAPSHOT"
 }

+ 0 - 22
native/engine/android/app/src/com/cocos/game/GameApp.java

@@ -1,22 +0,0 @@
-package com.cocos.game;
-
-import android.app.Application;
-
-import com.atmob.cocos.bridge.AtmobCocosBridge;
-import com.atmob.cocos.bridge.Config;
-import com.atmob.compliance.AtmobCompliance;
-import com.game.eliminate.BuildConfig;
-
-public class GameApp extends Application {
-    @Override
-    public void onCreate() {
-        super.onCreate();
-        AtmobCocosBridge.getInstance().init(this, new Config.Builder()
-                .debug(BuildConfig.DEBUG)
-                .testChannel(BuildConfig.TEST_CHANNEL)
-                .appKey(BuildConfig.ATMOB_CENTRAL_APP_KEY)
-                .gravityAccessToken(BuildConfig.GRAVITY_ACCESS_TOKEN)
-                .complianceStrategy(AtmobCompliance.Strategy.CHINA)
-                .build());
-    }
-}