我使用的是android studio 1.2 Beta 2的mac版本,建于2015年4月7日.Gradle版本2.2.1和Gradle插件版本1.1.0.
创建新项目后,默认情况下,我的app/build.gradle文件中存在以下代码.
...
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
}
Run Code Online (Sandbox Code Playgroud)
这意味着我添加到app/libs目录的任何jar文件都应该加载到我的项目中,对吗?但是,当我将Parse-1.9.0.jar添加到app/libs时,它没有被加载.我没能在MainActivity.java中使用API中的代码.
右键单击Parse-1.9.0.jar - > Add As Library ... app/build.gradle成为:
...
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile files('libs/Parse-1.9.0.jar')
}
Run Code Online (Sandbox Code Playgroud)
我很困惑为什么.不应该编译fileTree()包含所有jar文件?为什么我需要做额外的步骤?
我下载的Parse-1.9.0.jar文件来自:https://parse.com/apps/quickstart#parse_data/mobile/android/native/existing
谢谢
android gradle parse-platform android-studio android-gradle-plugin
我想以编程方式将以下 UI 更改为全屏。
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity"
>
<TextView
android:id="@+id/one"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="ONE"
android:background="@android:color/darker_gray"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintRight_toLeftOf="@+id/two"
/>
<TextView
android:id="@+id/two"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TWO"
android:background="@android:color/holo_blue_dark"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintLeft_toRightOf="@+id/one"
/>
</android.support.constraint.ConstraintLayout>
Run Code Online (Sandbox Code Playgroud)
在我的 Kotlin 文件中:
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
val param = ConstraintLayout.LayoutParams(0, 0)
one.layoutParams = param
two.layoutParams = param
}
}
Run Code Online (Sandbox Code Playgroud)
在我将宽度和高度设置为 0 而不是全屏刮擦后,两个 TextView 都消失了。
System.lineSeparator()我正在进行Android开发时无法使用.我不得不使用旧版本System.getProperty("line.separator").
任何人都可以向我解释为什么会这样?是因为Android SDK没有使用Java 7吗?
我知道我可以在Android Studio的项目结构中选择SDK位置。

我有两个问题:
当我们已经在使用Android SDK时,为什么需要JDK?毕竟,我们不是在为JVM开发。
使用JDK 1.6、1.7和1.8有什么区别吗?
我知道如何使用圆角对于视图将是这样的:
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="10dp"/>
</shape>
Run Code Online (Sandbox Code Playgroud)
半径范围是多少?它是0到100 dp?
我从Google Play控制台收到以下NDK崩溃报告,但在Crashlytics中没有.
#00 pc 0000000000049c44 /system/lib/libc.so (tgkill+12)
#01 pc 00000000000473e3 /system/lib/libc.so (pthread_kill+34)
#02 pc 000000000001d535 /system/lib/libc.so (raise+10)
#03 pc 0000000000019081 /system/lib/libc.so (__libc_android_abort+34)
#04 pc 00000000000170e4 /system/lib/libc.so (abort+4)
#05 pc 000000000000c3a1 /system/lib/libcutils.so (__android_log_assert+112)
#06 pc 000000000002352d /system/lib/libhwui.so
#07 pc 0000000000024db3 /system/lib/libhwui.so
#08 pc 00000000000281a9 /system/lib/libhwui.so (_ZN7android10uirenderer12renderthread12RenderThread10threadLoopEv+80)
#09 pc 000000000000e361 /system/lib/libutils.so (_ZN7android6Thread11_threadLoopEPv+140)
#10 pc 0000000000064d19 /system/lib/libandroid_runtime.so (_ZN7android14AndroidRuntime15javaThreadShellEPv+80)
#11 pc 0000000000046eb3 /system/lib/libc.so (_ZL15__pthread_startPv+22)
#12 pc 0000000000019acd /system/lib/libc.so (__start_thread+6)
Run Code Online (Sandbox Code Playgroud)
我想让Crashltytics也报告这些崩溃事件.我们不使用任何NDK库,崩溃应来自外部第三方库.我正在阅读https://docs.fabric.io/android/crashlytics/ndk.html,但仍不确定如何做到这一点.
鉴于我已经在我的Android应用程序中使用Crashlytics,我必须做出/添加的确切配置更改,以便崩溃报告NDK从外部第三方库崩溃?
在https://docs.fabric.io/android/crashlytics/ndk.html中,它提到了Uploading symbols for external dependencies.什么是 …
我是firebase的新手.在我的Android应用中,我希望每个用户只能访问他创建的数据.我正在阅读https://www.firebase.com/docs/security/guide/securing-data.html,但没有太多意义.假设我已经使用电子邮件和密码登录,
谢谢!
Firebase规则
{
"rules": {
".read": true,
".write": true
}
}
Run Code Online (Sandbox Code Playgroud)
Java代码
myFirebaseRef.child("message").setValue("This is the message");
Run Code Online (Sandbox Code Playgroud) 我有如下的Kotlin对象:
object TestObject {
val name: String = "Hi"
}
Run Code Online (Sandbox Code Playgroud)
我将如何TestObject用Java 引用?以下代码无法理解TestObject.name:
public class Main {
public static void main(String[] args) {
System.out.println(TestObject.name);
}
}
Run Code Online (Sandbox Code Playgroud)