问题标签 [android-studio-2.2]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
android - 警告:不要将 Android 上下文类放在静态字段中;这是内存泄漏(也破坏了即时运行)
安卓工作室:
不要将 Android 上下文类放在静态字段中;这是内存泄漏(也破坏了即时运行)
所以 2 个问题:
#1 如何在startService
没有上下文的静态变量的情况下从静态方法调用 a?
#2 如何从静态方法(相同)发送 localBroadcast?
例子:
或者
不使用的正确方法是什么mContext
?
注意:我认为我的主要问题可能是如何将上下文传递给调用方法所在的类。
android - 如何修复 Android Studio 2.2 无法识别 jar?
我最近从 Studio 2.1 升级到 2.2,并且在一个项目中我有一些库依赖项,并带来了旧的:
在 Studio 2.1 中,所有的 jar 都可以完美运行。但出于某种原因,在 2.2 中,IDE 似乎无法识别其中一个 jar - 它旁边没有扩展三角形,并且其中的类不可访问。构建项目工作得很好,所以 gradle 文件显然是正确的。但 Studio 2.2 就是无法识别它。
没有明显的错误。我已经尝试使用 gradle、clean 构建等反复重新同步配置,但似乎没有任何效果。我能想到的唯一可能导致它的原因是 JAR 非常大(2.6MB),但增加内存大小似乎没有帮助。
有没有人遇到过这个问题,或者有任何修复它的建议?
android - Android Studio 2.2 cmake 错误 (c++)
有没有人尝试在新的 Android Studio 2.2 预览版 3 中使用 CMake?
我在一个支持 C++ 的简单“Hello world”项目中遇到了这个错误:
android - 错误的构建变体
我的应用程序中有 2 个模块,一个用于 API,一个用于应用程序。在 API 模块中,我定义了 2 个 API 端点,具体取决于 API 是否以debug
或release
模式编译:
在 Android Studio 的Build variant
面板中,我为应用程序和 API 模块选择了调试变体。但是,当我手动按下 play/clean/rebuild/remove all build directory/resync gradle 时,无论我做什么都是每次都会编译的发布 API。
有什么提示吗?
尝试使用 gradle 构建工具2.1.0
和2.2.0-aplha3
.
android - Android Studio release build not zipaligning
I'm having trouble uploading my .apk to Google Play Store. I've previously been able to upload multiple different builds up to last week, but today I get the error that I should zipalign my file first.
EDIT: Normally, I was able to generate signed and zipaligned .apk's that the AppStore accepted by just using Android Studios built-in "Generate Signed APK" wizard. This did not work today, and led to the following:
I've tried the following:
Manual zipalign of the app-release.apk generated by Android studio. When I try this, I get the error "VERIFICATION FAILED" at the end. Some googling says that providing full path to a location where you have write-access is important, so I've tried doing it with the specific path, but to no avail:
./zipalign -v -f 4 /Users/<username>/git/<projectname>/app/app-release.apk /Users/<username>/git/<projectname>/app/aligned.apk
I then tried to download the APK Signer 1.8.5 and use that to zipalign the .apk - and behold, success! It creates an aligned apk, and i'm able to verify it using both Android Studio's own zipalign tool by
./zipalign -c -v 4 app-release_ALIGNED.apk
and the APK Signer itself. However, when uploading I now get the error:
Failed to run aapt dump badging: W/ResourceType(208730): Bad resource table: header size 0x80a3 or total size 0x80b50000 is larger than data size 0x7bcc4 ERROR: dump failed because the resource table is invalid/corrupt.
This, I haven't been able to find solutions for.
I then tried to recreate the circumstances I was previously able to upload APKs from by reverting to a previous commit/build, as well as reverting from AS 2.2 preview 3 to AS2.2 preview 2, but again - no luck.
Finally, I tried explicitly adding
zipAlignEnabled true
to my release config in Gradle, but that didn't help either.
I'm out of suggestions, and hoping someone can help? :-) Thanks
linux - Linux - Gradle 无法删除临时文件并且构建失败
当我执行$ gradle :android:clean
或$ gradle :android:assembleDebug
得到
我想提一下,该项目位于 NTFS 分区上。
我找到了一种解决方法,我正在使用--continue
选项来忽略构建失败。但我想知道为什么无法删除该文件。是不是被什么东西挡住了?