Android: static stl, getting deps using gradle, some fixes
This commit is contained in:
parent
1dd11bdc04
commit
d014f94141
@ -8,21 +8,6 @@ fi
|
|||||||
FOLDER=$(pwd)/app/src/main/assets
|
FOLDER=$(pwd)/app/src/main/assets
|
||||||
DEST=$(mktemp -d)
|
DEST=$(mktemp -d)
|
||||||
|
|
||||||
echo
|
|
||||||
echo "*** Starting build MultiCraft for Android... ***"
|
|
||||||
|
|
||||||
echo
|
|
||||||
echo "=> Getting precompiled dependencies:"
|
|
||||||
if [ ! -d native/deps ]; then
|
|
||||||
echo
|
|
||||||
git clone --depth 1 https://github.com/MultiCraft/deps native/deps
|
|
||||||
echo
|
|
||||||
echo "* Done!"
|
|
||||||
else
|
|
||||||
echo
|
|
||||||
echo "Already available, skipping..."
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo
|
echo
|
||||||
echo "=> Creating Assets:"
|
echo "=> Creating Assets:"
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ android {
|
|||||||
applicationId 'com.multicraft.game'
|
applicationId 'com.multicraft.game'
|
||||||
minSdkVersion 16
|
minSdkVersion 16
|
||||||
targetSdkVersion 29
|
targetSdkVersion 29
|
||||||
versionCode 23
|
versionCode 25
|
||||||
/*multiDexEnabled true*/
|
/*multiDexEnabled true*/
|
||||||
}
|
}
|
||||||
Properties props = new Properties()
|
Properties props = new Properties()
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
android:installLocation="auto"
|
android:installLocation="auto"
|
||||||
android:versionName="@string/ver">
|
android:versionName="@string/ver">
|
||||||
|
|
||||||
|
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||||
<uses-permission android:name="android.permission.INTERNET" />
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
<uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT" />
|
<uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT" />
|
||||||
|
@ -24,12 +24,11 @@ import static com.multicraft.game.AdManager.stopAd;*/
|
|||||||
public class GameActivity extends NativeActivity {
|
public class GameActivity extends NativeActivity {
|
||||||
static {
|
static {
|
||||||
try {
|
try {
|
||||||
System.loadLibrary("c++_shared");
|
|
||||||
System.loadLibrary("MultiCraft");
|
System.loadLibrary("MultiCraft");
|
||||||
} catch (UnsatisfiedLinkError e) {
|
} catch (UnsatisfiedLinkError e) {
|
||||||
Bugsnag.notify(e);
|
Bugsnag.notify(e);
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException i) {
|
||||||
Bugsnag.notify(e);
|
Bugsnag.notify(i);
|
||||||
} catch (OutOfMemoryError e) {
|
} catch (OutOfMemoryError e) {
|
||||||
Bugsnag.notify(e);
|
Bugsnag.notify(e);
|
||||||
} catch (Error | Exception error) {
|
} catch (Error | Exception error) {
|
||||||
@ -51,6 +50,7 @@ public class GameActivity extends NativeActivity {
|
|||||||
Bundle bundle = getIntent().getExtras();
|
Bundle bundle = getIntent().getExtras();
|
||||||
height = bundle != null ? bundle.getInt("height", 0) : getResources().getDisplayMetrics().heightPixels;
|
height = bundle != null ? bundle.getInt("height", 0) : getResources().getDisplayMetrics().heightPixels;
|
||||||
width = bundle != null ? bundle.getInt("width", 0) : getResources().getDisplayMetrics().widthPixels;
|
width = bundle != null ? bundle.getInt("width", 0) : getResources().getDisplayMetrics().widthPixels;
|
||||||
|
/*consent = bundle == null || bundle.getBoolean("consent", true);*/
|
||||||
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||||
messageReturnCode = -1;
|
messageReturnCode = -1;
|
||||||
messageReturnValue = "";
|
messageReturnValue = "";
|
||||||
@ -138,9 +138,9 @@ public class GameActivity extends NativeActivity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void notifyServerConnect(boolean isMultiPlayer) {
|
public void notifyServerConnect(boolean isMultiplayer) {
|
||||||
/*isMultiPlayer = isMultiPlayer;
|
/*isMultiPlayer = isMultiplayer;
|
||||||
if (isMultiPlayer) stopAd();*/
|
if (isMultiplayer) stopAd();*/
|
||||||
}
|
}
|
||||||
|
|
||||||
public void notifyAbortLoading() {
|
public void notifyAbortLoading() {
|
||||||
@ -149,22 +149,20 @@ public class GameActivity extends NativeActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void notifyExitGame() {
|
public void notifyExitGame() {
|
||||||
/*if (isMultiPlayer)
|
/*if (isMultiPlayer) startAd(this, false, true);*/
|
||||||
startAd(this, false, true);*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("StaticFieldLeak")
|
/*@SuppressLint("StaticFieldLeak")
|
||||||
class AdInitTask extends AsyncTask<Void, Void, Void> {
|
class AdInitTask extends AsyncTask<Void, Void, Void> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Void doInBackground(Void... voids) {
|
protected Void doInBackground(Void... voids) {
|
||||||
/*initAd(GameActivity.this, consent);*/
|
initAd(GameActivity.this, consent);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onPostExecute(Void aVoid) {
|
protected void onPostExecute(Void aVoid) {
|
||||||
/*setAdsCallback(GameActivity.this);*/
|
setAdsCallback(GameActivity.this);
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,6 @@ package com.multicraft.game;
|
|||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
@ -34,13 +33,12 @@ public class InputDialogActivity extends AppCompatActivity {
|
|||||||
editText.requestFocus();
|
editText.requestFocus();
|
||||||
editText.setHint(hint);
|
editText.setHint(hint);
|
||||||
editText.setText(current);
|
editText.setText(current);
|
||||||
final InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
|
final InputMethodManager imm = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);
|
||||||
Objects.requireNonNull(imm).toggleSoftInput(InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_IMPLICIT_ONLY);
|
Objects.requireNonNull(imm).toggleSoftInput(InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_IMPLICIT_ONLY);
|
||||||
if (editType == 3) {
|
if (editType == 3)
|
||||||
editText.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
|
editText.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
|
||||||
} else {
|
else
|
||||||
editText.setInputType(InputType.TYPE_CLASS_TEXT);
|
editText.setInputType(InputType.TYPE_CLASS_TEXT);
|
||||||
}
|
|
||||||
editText.setOnKeyListener((view, KeyCode, event) -> {
|
editText.setOnKeyListener((view, KeyCode, event) -> {
|
||||||
if (KeyCode == KeyEvent.KEYCODE_ENTER) {
|
if (KeyCode == KeyEvent.KEYCODE_ENTER) {
|
||||||
imm.hideSoftInputFromWindow(editText.getWindowToken(), 0);
|
imm.hideSoftInputFromWindow(editText.getWindowToken(), 0);
|
||||||
|
@ -232,12 +232,11 @@ class WVersionManager implements DialogsCallback {
|
|||||||
if (result != null) {
|
if (result != null) {
|
||||||
try {
|
try {
|
||||||
String content;
|
String content;
|
||||||
if (!result.startsWith("{")) { // for response who append with unknown char
|
if (!result.startsWith("{")) // for response who append with unknown char
|
||||||
result = result.substring(1);
|
result = result.substring(1);
|
||||||
}
|
|
||||||
String mResult = result;
|
String mResult = result;
|
||||||
// json format from server:
|
// json format from server:
|
||||||
JSONObject json = (JSONObject) new JSONTokener(mResult).nextValue();
|
JSONObject json = new JSONObject(new JSONTokener(mResult));
|
||||||
mVersionCode = json.optInt("version_code");
|
mVersionCode = json.optInt("version_code");
|
||||||
String lang = Locale.getDefault().getLanguage();
|
String lang = Locale.getDefault().getLanguage();
|
||||||
if (lang.equals("ru"))
|
if (lang.equals("ru"))
|
||||||
|
@ -7,6 +7,8 @@ buildscript {
|
|||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:3.5.2'
|
classpath 'com.android.tools.build:gradle:3.5.2'
|
||||||
|
//noinspection GradleDependency
|
||||||
|
classpath 'org.ajoberstar:gradle-git:0.6.5'
|
||||||
// NOTE: Do not place your application dependencies here; they belong
|
// NOTE: Do not place your application dependencies here; they belong
|
||||||
// in the individual module build.gradle files
|
// in the individual module build.gradle files
|
||||||
}
|
}
|
||||||
|
BIN
build/android/gradle/wrapper/gradle-wrapper.jar
vendored
BIN
build/android/gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
@ -1 +1,6 @@
|
|||||||
|
#Sun Nov 17 19:50:29 CET 2019
|
||||||
|
distributionBase=GRADLE_USER_HOME
|
||||||
|
distributionPath=wrapper/dists
|
||||||
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
zipStorePath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip
|
||||||
|
22
build/android/gradlew
vendored
22
build/android/gradlew
vendored
@ -1,5 +1,21 @@
|
|||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
#
|
||||||
|
# Copyright 2015 the original author or authors.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
#
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
##
|
##
|
||||||
## Gradle start up script for UN*X
|
## Gradle start up script for UN*X
|
||||||
@ -28,7 +44,7 @@ APP_NAME="Gradle"
|
|||||||
APP_BASE_NAME=`basename "$0"`
|
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.
|
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
DEFAULT_JVM_OPTS=""
|
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||||
|
|
||||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
MAX_FD="maximum"
|
MAX_FD="maximum"
|
||||||
@ -109,8 +125,8 @@ if $darwin; then
|
|||||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# For Cygwin, switch paths to Windows format before running java
|
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||||
if $cygwin ; then
|
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
||||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||||
|
18
build/android/gradlew.bat
vendored
18
build/android/gradlew.bat
vendored
@ -1,3 +1,19 @@
|
|||||||
|
@rem
|
||||||
|
@rem Copyright 2015 the original author or authors.
|
||||||
|
@rem
|
||||||
|
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
@rem you may not use this file except in compliance with the License.
|
||||||
|
@rem You may obtain a copy of the License at
|
||||||
|
@rem
|
||||||
|
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
@rem
|
||||||
|
@rem Unless required by applicable law or agreed to in writing, software
|
||||||
|
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
@rem See the License for the specific language governing permissions and
|
||||||
|
@rem limitations under the License.
|
||||||
|
@rem
|
||||||
|
|
||||||
@if "%DEBUG%" == "" @echo off
|
@if "%DEBUG%" == "" @echo off
|
||||||
@rem ##########################################################################
|
@rem ##########################################################################
|
||||||
@rem
|
@rem
|
||||||
@ -14,7 +30,7 @@ set APP_BASE_NAME=%~n0
|
|||||||
set APP_HOME=%DIRNAME%
|
set APP_HOME=%DIRNAME%
|
||||||
|
|
||||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
set DEFAULT_JVM_OPTS=
|
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||||
|
|
||||||
@rem Find java.exe
|
@rem Find java.exe
|
||||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
apply plugin: 'com.android.library'
|
apply plugin: 'com.android.library'
|
||||||
|
import org.ajoberstar.gradle.git.tasks.*
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 29
|
compileSdkVersion 29
|
||||||
@ -9,7 +10,7 @@ android {
|
|||||||
externalNativeBuild {
|
externalNativeBuild {
|
||||||
ndkBuild {
|
ndkBuild {
|
||||||
arguments '-j',
|
arguments '-j',
|
||||||
'APP_STL=c++_shared',
|
'APP_STL=c++_static',
|
||||||
'COMPILER_VERSION=clang',
|
'COMPILER_VERSION=clang',
|
||||||
'APP_SHORT_COMMANDS=true'
|
'APP_SHORT_COMMANDS=true'
|
||||||
}
|
}
|
||||||
@ -41,3 +42,17 @@ android {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
task cloneGitRepo(type: GitClone) {
|
||||||
|
def destination = file('deps')
|
||||||
|
uri ='https://github.com/MultiCraft/deps'
|
||||||
|
destinationPath = destination
|
||||||
|
bare = false
|
||||||
|
enabled = !destination.exists()
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation 'com.android.support:appcompat-v7'
|
||||||
|
}
|
||||||
|
|
||||||
|
preBuild.dependsOn cloneGitRepo
|
||||||
|
Loading…
x
Reference in New Issue
Block a user