我的项目在 AVD 上正确运行。但是当我尝试生成签名的 APK 时,gradle 出现此错误:
FAILURE: Build failed with an exception.
* What went wrong:
java.lang.IllegalStateException: Expected BEGIN_ARRAY but was BEGIN_OBJECT at line 1 column 2 path $
> Expected BEGIN_ARRAY but was BEGIN_OBJECT at line 1 column 2 path $
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more
log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
Run Code Online (Sandbox Code Playgroud)
我已经多次使用这个命令:gson.fromJson
. …
错误:我想将Realm数据库从版本4.2.0更新到4.3.3,但在gradle sync之后,它将失败
目标
将Realm从4.2.0更新到4.3.3
预期成绩
Gradle sync将成功
实际结果
gratra同步失败,堆栈跟踪:
Error:Execution failed for task ':QuizApp:processDebugResources'.
Could not get unknown property 'packageForR' for task
':QuizApp:processDebugResources' of type
com.android.build.gradle.internal.res.LinkApplicationAndroidResourcesTask.
Run Code Online (Sandbox Code Playgroud)
顶级gradle文件
buildscript {
repositories {
jcenter { url 'http://jcenter.bintray.com/' }
maven { url 'https://maven.fabric.io/public' }
maven { url "https://plugins.gradle.org/m2/" }
jcenter()
mavenCentral()
google()
}
dependencies {
// classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.android.tools.build:gradle:3.2.0-alpha01'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7'
classpath 'io.fabric.tools:gradle:1.+'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module …
Run Code Online (Sandbox Code Playgroud) 我将我的项目从Eclipse导入Android Studio V2.2.2.但是当Gradle构建完成后,我在Logcat中出现了这个错误,并在模拟器上显示了一个白色屏幕5-10秒.我有所有可用的解决方案,但到目前为止我还没有找到解决这个问题的方法.我提前为可怜的英语道歉.
和我的模拟器屏幕:
在我将Android工作室从2.3.3更新到3.0后,编译并运行后出现此错误(rror inflating class com.astuetz.PagerSlidingTabStrip)请参阅下面的日志错误:
android.view.InflateException: Binary XML file line #0: Binary XML file line #0: Error inflating class com.astuetz.PagerSlidingTabStrip
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2643)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2709)
at android.app.ActivityThread.access$1000(ActivityThread.java:196)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1534)
at android.os.Handler.dispatchMessage(Handler.java:111)
at android.os.Looper.loop(Looper.java:207)
at android.app.ActivityThread.main(ActivityThread.java:5867)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1026)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:887)
Caused by: android.view.InflateException: Binary XML file line #0: Binary XML file line #0: Error inflating class com.astuetz.PagerSlidingTabStrip
at android.view.LayoutInflater.inflate(LayoutInflater.java:545)
at android.view.LayoutInflater.inflate(LayoutInflater.java:429)
at android.view.LayoutInflater.inflate(LayoutInflater.java:380)
at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:436)
at android.app.Activity.setContentView(Activity.java:2205)
at com.goalplusapp.goalplus.MainActivity.onCreate(MainActivity.java:325)
at android.app.Activity.performCreate(Activity.java:6285)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1119)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2596)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2709)
at android.app.ActivityThread.access$1000(ActivityThread.java:196)
at …
Run Code Online (Sandbox Code Playgroud) 这是我的gradle文件:
apply plugin: 'com.android.application'
apply plugin: 'com.jakewharton.butterknife'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
android {
compileSdkVersion 27
defaultConfig {
vectorDrawables.useSupportLibrary = true
applicationId "com.android.****"
minSdkVersion 16
targetSdkVersion 27
buildToolsVersion '28.0.0-rc1'
versionCode 1
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_1_8
}
packagingOptions {
pickFirst 'META-INF/license.txt'
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
exclude …
Run Code Online (Sandbox Code Playgroud) 我将Picasso用作我的App项目和聊天库的依赖项
这是我在编译代码时遇到的错误:
程序类型已存在:org.apache.http.auth.AuthSchemeFactory消息{种类=错误,文本=程序类型已存在:
org.apache.http.auth.AuthSchemeFactory,来源= [未知源文件],工具名称= Optional.of(D8)}
那么如何对两个项目使用相同的依赖关系?
---- Root project----
|
|
---app
|
---chat library
Run Code Online (Sandbox Code Playgroud)
编辑星期六-2018年4月14日
在app> libs文件夹中,jar
存在以下文件:
我正在使用Android Studio 3.5 Canary 7。当我调试项目时,菜单中的“ 应用代码更改 ”被禁用。一次,这对我的项目有效,但今天却没有。我应检查哪些设置以使其起作用?
我尝试通过以下代码隐藏NavigationBar:
public static void setFullscreen(final View decorView) {
decorView.setOnSystemUiVisibilityChangeListener(new View.OnSystemUiVisibilityChangeListener() {
@Override
public void onSystemUiVisibilityChange(int visibility) {
if ((visibility & View.SYSTEM_UI_FLAG_FULLSCREEN) == 0) {
decorView.setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
}
}
});
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN) {
decorView.setSystemUiVisibility(decorView.getSystemUiVisibility());
}
}
Run Code Online (Sandbox Code Playgroud)
并为每个活动:
@Override
public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);
if (hasFocus) {
getWindow().getDecorView().setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);}
}
Run Code Online (Sandbox Code Playgroud)
和活动主题:
<style name="Theme.AppCompat.Light.NoActionBar.FullScreen" parent="@style/Theme.AppCompat.Light">
<item name="windowNoTitle">true</item>
<item name="windowActionBar">true</item>
<item …
Run Code Online (Sandbox Code Playgroud)