小编gah*_*hfy的帖子

Android Studio vs Eclipse + ADT插件?

我想对这个问题有客观的答案:

为什么我应该使用Android Studio,遇到问题和复杂的任务,例如,导入为Eclipse开发的库,对我可能遇到的bug的支持较少,而不是继续使用Eclipse?

Android Studio与Eclipse的真正优势是什么?

eclipse android android-studio

95
推荐指数
3
解决办法
6万
查看次数

在Android KitKat上中止短信意图

我目前正在开发一个应用程序,只有当它是应用程序预期的SMS时才需要处理SMS(与Whatsapp在注册时的行为相同).

我想中止SMS Intent,因为它不会出现在SMS框中.

我的问题是:我知道谷歌改变了很多关于KitKat中的短信行为,现在,即使我的短信被我的应用程序很好地解析,短信也出现在SMSBox中,即使我this.abortBroadcast();在我的短信广播接收器中呼叫.那么有没有办法避免这些短信出现在短信框中而无需开发完整的短信应用程序?

有关信息,此广播接收器的清单文件中的优先级尚未达到1000(我也尝试使用MAX Integer).

sms android smsmanager android-broadcast android-4.4-kitkat

10
推荐指数
1
解决办法
4767
查看次数

无法安装我的应用程序

我试图在我现有的应用程序中添加一个磨损模块,尝试了很多解决方案,但无法弄清楚为什么我的应用程序没有安装在我的手表上.

我尝试了什么:

首先,使用我的应用程序手动打包:https://developer.android.com/training/wearables/apps/packaging.html

但我很快就决定不通过这个.

然后我决定去gradle include,所以对于app的build.gradle,我将以下内容添加到依赖项的末尾:

debugWearApp project(path:':wear', configuration: 'flavor1Debug')
releaseWearApp project(path:':wear', configuration: 'flavor1Release')
Run Code Online (Sandbox Code Playgroud)

对于build.gradle的磨损,我在依赖的开头添加了以下内容:

wearApp project(':wear')
Run Code Online (Sandbox Code Playgroud)

然后,在android{}build build.gradle的部分,之后buildToolsVersion,我添加了以下内容:

publishNonDefault true
Run Code Online (Sandbox Code Playgroud)

我所看到的:

  • 使用蓝牙调试磨损将磨损应用程序安装到磨损上没问题

然后,当我安装一个生成我的应用程序的发布版本时,我可以看到它已经添加了一个文件android_wear_micro_apk.apk到res/raw这是我的手表应用程序.我还在res/xml中看到了一个文件android_wear_micro_apk.xml,我猜想在hexa代码之间,有一个穿戴app的描述.

然后我比较签名:

keytool -list -printcert -jarfile mobile_app.apk
keytool -list -printcert -jarfile wear_app.apk
Run Code Online (Sandbox Code Playgroud)

使用res/raw中生成的磨损应用程序.它们完全具有相同的签名.然后我比较:

aapt dump badging mobile_app.apk
aapt dump badging wear_app.apk
Run Code Online (Sandbox Code Playgroud)

它们具有完全相同的包名称和版本代码和名称.

所以,从那个:

  • 正确添加穿戴Apk
  • 如果使用adb和bluetooth调试安装在磨损上,则穿戴的Apk正在工作
  • 两个apk都有相同的版本号,版本名称和包名
  • 磨损不需要任何许可
  • 电话正在请求以下权限
    • android.permission.ACCESS_NETWORK_STATE
    • android.permission.INTERNET对
    • com.android.vending.BILLING
    • com.google.android.c2dm.permission.RECEIVE
    • android.permission.VIBRATE
    • android.permission.WRITE_EXTERNAL_STORAGE
    • android.permission.BLUETOOTH
    • android.permission.BLUETOOTH_ADMIN
    • com.samsung.accessory.permission.ACCESSORY_FRAMEWORK
    • com.samsung.android.providers.context.permission.WRITE_USE_APP_FEATURE_SURVEY
    • com.samsung.WATCH_APP_TYPE.Companion
    • com.samsung.wmanager.ENABLE_NOTIFICATION

我真的很想知道我能忘记什么.

谢谢你的帮助

android wear-os

7
推荐指数
1
解决办法
2030
查看次数

JUnit中的ClassCastException使用Android KitKat进行测试

我在Android KitKat上发现了一个以前没有出现的问题.

我正在使用Robotium进行JUnit测试,测试中的所有内容都运行良好,除了Android KitKat(尝试使用Nexus 4更新和nexus 5).

当我想执行一个独奏动作时,我总是有同样的例外:

java.lang.ClassCastException: java.util.ArrayList cannot be cast to android.view.View[]
at com.jayway.android.robotium.solo.ViewFetcher.getWindowDecorViews(ViewFetcher.java:399)
at com.jayway.android.robotium.solo.ViewFetcher.getAllViews(ViewFetcher.java:81)
at com.jayway.android.robotium.solo.Searcher.searchFor(Searcher.java:165)
at com.jayway.android.robotium.solo.Waiter.waitForView(Waiter.java:254)
at com.jayway.android.robotium.solo.Waiter.waitForView(Waiter.java:233)
at com.jayway.android.robotium.solo.Solo.clickOnView(Solo.java:967)
at com.example.TestClass.testMethod(TestClass.java:61)
at java.lang.reflect.Method.invokeNative(Native Method)
at android.test.InstrumentationTestCase.runMethod(InstrumentationTestCase.java:214)
at android.test.InstrumentationTestCase.runTest(InstrumentationTestCase.java:199)
at android.test.ActivityInstrumentationTestCase2.runTest(ActivityInstrumentationTestCase2.java:192)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:191)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:176)
at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:554)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1701)
Run Code Online (Sandbox Code Playgroud)

你知道是否有原因吗?

junit android

6
推荐指数
1
解决办法
1239
查看次数