Прежде всего, извините за плохой Engli sh.
Ребята, у меня есть старый проект с minsdk 14 и compil / target 22. Я изменил на 28 для загрузки в Google Play. Поменял все на AppCompatActivity в java файлах и сделал импорт. Но есть проблема с apk.
Нет ошибок в коде, нет ошибок в «run» app. Но приложение не открывается, каждый раз ошибка.
новый gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
buildToolsVersion "29.0.3"
compileOptions.encoding = 'windows-1251' //кодировка
defaultConfig {
applicationId "com.my.app"
minSdkVersion 14
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}
новый java пример
package com.my.app;
import android.content.Intent;
import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import android.view.View;
public class Activity extends AppCompatActivity implements View.OnClickListener {
старый gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion '22.0.1'
compileOptions.encoding = 'windows-1251' //кодировка
defaultConfig {
applicationId "com.my.app"
minSdkVersion 14
targetSdkVersion 22
versionCode 1
versionName "1.0.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.android.support:support-v4:22.2.0'
compile 'com.google.android.gms:play-services:7.5.0'
compile files('libs/Parse-1.9.3.jar')
compile files('libs/bolts-android-1.2.0.jar')
}
старый java пример
package com.my.app;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
public class Activity extends ActionBarActivity implements View.OnClickListener {
и увидел, что в прогоне
E/AndroidRuntime: FATAL EXCEPTION: pool-1-thread-3
Process: com.my,app, PID: 30993
java.lang.NoClassDefFoundError: Failed resolution of: Lorg/apache/http/client/ClientProtocolException;
at com.parse.ParseRequest$2.then(ParseRequest.java:195)
at com.parse.ParseRequest$2.then(ParseRequest.java:190)
at bolts.Task$14.run(Task.java:796)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:764)
Caused by: java.lang.ClassNotFoundException: Didn't find class "org.apache.http.client.ClientProtocolException" on path: DexPathList[[zip file "/data/app/com.my.app-A1k1kce0AmLrPJ8ojgBekA==/base.apk"],nativeLibraryDirectories=[/data/app/com.my.app-A1k1kce0AmLrPJ8ojgBekA==/lib/arm64, /system/lib64, /system/vendor/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at com.parse.ParseRequest$2.then(ParseRequest.java:195)
at com.parse.ParseRequest$2.then(ParseRequest.java:190)
at bolts.Task$14.run(Task.java:796)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:764)
Caused by: java.lang.ClassNotFoundException: Didn't find class "org.apache.http.client.ClientProtocolException" on path: DexPathList[[zip file "/data/app/com.my.app-A1k1kce0AmLrPJ8ojgBekA==/base.apk"],nativeLibraryDirectories=[/data/app/com.my.app-A1k1kce0AmLrPJ8ojgBekA==/lib/arm64, /system/lib64, /system/vendor/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at com.parse.ParseRequest$2.then(ParseRequest.java:195)
at com.parse.ParseRequest$2.then(ParseRequest.java:190)
at bolts.Task$14.run(Task.java:796)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:764)