Skip to content

Gradle issues fix #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ All classes and methods are covered by instrumented tests.
* Galaxy J5 (API23)
* Galaxy S3 (API23 - СyanogenMod 14.1)
* Galaxy S7 (API23)
* Nexus 9 (API23)
* Xperia Z3 Compact (API23)
* Nexus 9 (API25)
* General AVD's (API21 - API25)

### Known issues:
Expand Down
36 changes: 9 additions & 27 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,25 +31,20 @@ apply plugin: 'com.android.application'

def final int MIN_SDK_MAIN = 19
def final String VERSION_NAME = '0.0.1'
def final int SDK_VER = Integer.parseInt(sdkVer)
def final int TARGET_SDK_VERSION = 25
def final String BUILD_TOOLS_VERSION = '25.0.2'
/*=====================================================*/

android {
compileSdkVersion SDK_VER
buildToolsVersion buildToolsVer
compileSdkVersion TARGET_SDK_VERSION
buildToolsVersion BUILD_TOOLS_VERSION

signingConfigs {
releaseConfig {
storeFile file(sigStoreFile)
storePassword sigStorePassword
keyAlias sigKeyAlias
keyPassword sigKeyPassword
}
}

//noinspection GroovyMissingReturnStatement
defaultConfig {
versionName VERSION_NAME; minSdkVersion MIN_SDK_MAIN; targetSdkVersion SDK_VER
versionName VERSION_NAME
minSdkVersion MIN_SDK_MAIN
targetSdkVersion TARGET_SDK_VERSION
dexOptions { javaMaxHeapSize "12288M" }
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
Expand All @@ -59,7 +54,6 @@ android {
jackOptions { enabled false }
consumerProguardFiles 'proguard-rules.pro'
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
//externalNativeBuild {cmake {cppFlags ""}}
}

buildTypes {
Expand All @@ -68,23 +62,11 @@ android {
debuggable false; useProguard true; shrinkResources true; minifyEnabled true
proguardFile 'proguard-rules.pro'
//noinspection GroovyAssignabilityCheck
signingConfig signingConfigs.releaseConfig
manifestPlaceholders = [exported: true]
}
}
}

configurations.all {
resolutionStrategy {
force 'junit:junit:4.12'
force 'com.android.support:support-annotations:25.2.0'
force 'com.android.support:support-v4:25.2.0'
force 'com.android.support:appcompat-v7:25.2.0'
force 'com.android.support:design:25.2.0'
force 'com.android.support:recyclerview-v7:25.2.0'
}
}

dependencies {
/* Proguard rules */
compile 'com.infstory:proguard-annotations:1.0.2'
Expand All @@ -93,7 +75,7 @@ dependencies {
/* App compatibility */
compile 'com.android.support:appcompat-v7:25.3.0'

//compile project(':lib')
compile 'ru.nikitenkogleb:mpegencoder:0.0.1'
compile project(':lib')
//compile 'ru.nikitenkogleb:mpegencoder:0.0.1'

}
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ public final class MainActivity extends AppCompatActivity {
private static final int IFRAME_INTERVAL = 1;

/** The one seconds of video. */
@SuppressWarnings("PointlessArithmeticExpression")
private static final int NUM_FRAMES = 131;

/** The input buffer. */
Expand All @@ -101,7 +100,7 @@ public final class MainActivity extends AppCompatActivity {

/** The parsing task. */
@Nullable
private ParseTask mParseTask = null;
private EncodeTask mEncodeTask = null;

/** Is video playing. */
private boolean mNowPlaying = false;
Expand All @@ -124,18 +123,14 @@ protected final void onCreate(@Nullable Bundle savedInstanceState) {

setContentView(mContentView);

startParseTask(new File(getFilesDir(), OUTPUT_FILE_NAME).getAbsolutePath());

//Total methods in lib-release.aar: 157 (0,24% used)
//Total fields in lib-release.aar: 48 (0,07% used)
// 27762 bytes
startEncode(new File(getFilesDir(), OUTPUT_FILE_NAME).getAbsolutePath());
}

/** {@inheritDoc} */
@Override
protected final void onDestroy() {

stopParseTask();
stopEncodeTask();
stopVideo();

assert mContentView != null;
Expand Down Expand Up @@ -197,23 +192,23 @@ private void resumeVideo() {
}
}

/** Start parse task. */
private void startParseTask(@NonNull String fileName) {
stopParseTask();
mParseTask = new ParseTask(this, fileName);
/** Start encode task. */
private void startEncode(@NonNull String fileName) {
stopEncodeTask();
mEncodeTask = new EncodeTask(this, fileName);
}

/** Cancel Parse Task. */
private void stopParseTask() {
if (mParseTask != null) {
mParseTask.close();
mParseTask = null;
/** Cancel encode Task. */
private void stopEncodeTask() {
if (mEncodeTask != null) {
mEncodeTask.close();
mEncodeTask = null;
}
}


/** The mp4 encoding task. */
private static final class ParseTask extends AsyncTask<Void, Void, Void> implements Closeable {
private static final class EncodeTask extends AsyncTask<Void, Void, Void> implements Closeable {

/** The main activity weak reference. */
@NonNull
Expand All @@ -228,12 +223,12 @@ private static final class ParseTask extends AsyncTask<Void, Void, Void> impleme
private final String mFilePath;

/**
* Constructs a new {@link ParseTask} with a {@link MainActivity} reference.
* Constructs a new {@link EncodeTask} with a {@link MainActivity} reference.
*
* @param activity the {@link MainActivity} instance
* @param filePath the output file path
*/
ParseTask(@NonNull MainActivity activity, @NonNull String filePath) {
EncodeTask(@NonNull MainActivity activity, @NonNull String filePath) {
mMainActivityWeakReference = new WeakReference<>(activity);
mFilePath = filePath; mAssetManager = activity.getAssets();
execute();
Expand Down
1 change: 0 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ buildscript {
allprojects {
repositories {
jcenter()
maven { url myMavenRepoReadUrl }
}
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:deprecation"
Expand Down
34 changes: 8 additions & 26 deletions lib/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,25 +33,19 @@ apply plugin: 'com.getkeepsafe.dexcount'

def final int MIN_SDK_MAIN = 19
def final String VERSION_NAME = '0.0.1'
def final int SDK_VER = Integer.parseInt(sdkVer)
def final int TARGET_SDK_VERSION = 25
def final String BUILD_TOOLS_VERSION = '25.0.2'
/*=====================================================*/

android {
compileSdkVersion SDK_VER
buildToolsVersion buildToolsVer

signingConfigs {
releaseConfig {
storeFile file(sigStoreFile)
storePassword sigStorePassword
keyAlias sigKeyAlias
keyPassword sigKeyPassword
}
}
compileSdkVersion TARGET_SDK_VERSION
buildToolsVersion BUILD_TOOLS_VERSION

//noinspection GroovyMissingReturnStatement
defaultConfig {
versionName VERSION_NAME; minSdkVersion MIN_SDK_MAIN; targetSdkVersion SDK_VER
versionName VERSION_NAME
minSdkVersion MIN_SDK_MAIN
targetSdkVersion TARGET_SDK_VERSION
dexOptions { javaMaxHeapSize "12288M" }
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
Expand All @@ -68,7 +62,6 @@ android {
debuggable false; useProguard true; shrinkResources true; minifyEnabled true
proguardFile 'proguard-rules.pro'
//noinspection GroovyAssignabilityCheck
signingConfig signingConfigs.releaseConfig
manifestPlaceholders = [exported: true]
}
}
Expand Down Expand Up @@ -97,22 +90,11 @@ publishing {
repositories {
maven {
//noinspection GroovyAssignabilityCheck
url myMavenRepoWriteUrl
//url myMavenRepoWriteUrl
}
}
}

/*configurations.all {
resolutionStrategy {
force 'junit:junit:4.12'
force 'com.android.support:support-annotations:25.2.0'
force 'com.android.support:support-v4:25.2.0'
force 'com.android.support:appcompat-v7:25.2.0'
force 'com.android.support:design:25.2.0'
force 'com.android.support:recyclerview-v7:25.2.0'
}
}*/

dependencies {
/* Proguard rules */
compile 'com.infstory:proguard-annotations:1.0.2'
Expand Down