我有一个使用Maven的Android项目.
它适用于运行Windows XP的旧计算机.但现在在我的另一台计算机上运行maven时出现此错误:
Failed to execute goal com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.6.0:generate-sources (default-generate-sources) on project my-android-application: Execution default-generate-sources of goal com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.6.0:generate-sources failed: A required class was missing while executing com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.6.0:generate-sources: Lorg/sonatype/aether/RepositorySystem;
Run Code Online (Sandbox Code Playgroud)
我正在运行Windows 7 32位.
C:\Checkouts\Project\Src\Android\BuildResources>mvn -version
Apache Maven 3.1.0 (893ca28a1da9d5f51ac03827af98bb730128f9f2; 2013-06-28 10:15:32+0800)
Maven home: C:\Programs\apache-maven-3.1.0
Java version: 1.6.0_33, vendor: Sun Microsystems Inc.
Java home: C:\Program Files\Java\jdk1.6.0_33\jre
Default locale: en_SG, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "x86", family: "windows"
Run Code Online (Sandbox Code Playgroud) 我在运行Jellybean(4.1 - 4.3)的设备中遇到HttpUrlConnection的一些问题,其中连接未关闭并且在执行多次后导致SocketException"Too many open files".
我打算调用HttpUrlConnection.disconnect()并关闭finally块中的所有Inputstream,Outputstream,Reader和Writers.
转到adb shell并执行netstat
显示应用程序创建的所有连接都处于CLOSE_WAIT状态.
InputStream inputStream = httpUrlConnection.getInputStream();
// After calling inputStream.read() then the problem occurs. I think the
// inputstream doesn't get closed even after calling close in a finally block.
// The InputStream is a ChunkedInputStream if that helps.
Run Code Online (Sandbox Code Playgroud)
我尝试过在2.3.3,4.0.3和4.4上运行的其他设备并没有遇到这个问题.
还有其他方法可以手动关闭连接吗?
这是我第一次使用Android-Facebook SDK.我想发布一个位图,但我继续收到这条消息:
Warning: Error: com.facebook.FacebookException: Failed to copy image.
Run Code Online (Sandbox Code Playgroud)
我可以发布简单的链接,但不能发布带照片的链接.
我该怎么解决这个问题?另外,我注意到的一件事是没有调用StatusCallback.call().
public abstract class FacebookReadyBaseActivity extends Activity {
private static final String TAG = "FacebookReadyBaseActivity";
private UiLifecycleHelper uiHelper;
protected PendingAction pendingAction = PendingAction.NONE;
private static final String PERMISSION = "publish_actions";
protected boolean canPresentShareDialogWithPhotos;
private boolean canPresentShareDialog;
private GraphUser user;
private GraphPlace place;
private List<GraphUser> tags;
protected Bitmap pendingBitmap;
protected enum PendingAction {
NONE, POST_PHOTO, POST_STATUS_UPDATE
}
private Session.StatusCallback callback = new Session.StatusCallback() {
@Override
public void call(Session session, SessionState state, …
Run Code Online (Sandbox Code Playgroud) 从数据源搜索项目时,我有以下 UI 流程:
Outcome.loading(true)
Outcome.success(results)
Outcome.loading(false)
现在的问题是当应用程序在后台时调用 #2 和 #3。恢复应用程序,LiveData 观察者只会收到 #3 而不是 #2 导致未填充 RecyclerView 的通知。
处理这种情况的正确方法是什么?
class SearchViewModel @Inject constructor(
private val dataSource: MusicInfoRepositoryInterface,
private val scheduler: Scheduler,
private val disposables: CompositeDisposable) : ViewModel() {
private val searchOutcome = MutableLiveData<Outcome<List<MusicInfo>>>()
val searchOutcomLiveData: LiveData<Outcome<List<MusicInfo>>>
get() = searchOutcome
fun search(searchText: String) {
Timber.d(".loadMusicInfos")
if(searchText.isBlank()) {
return
}
dataSource.search(searchText)
.observeOn(scheduler.mainThread())
.startWith(Outcome.loading(true))
.onErrorReturn { throwable -> Outcome.failure(throwable) }
.doOnTerminate { searchOutcome.value …
Run Code Online (Sandbox Code Playgroud) 目前我们有一个项目,而不是使用res/drawable文件夹来存储图像,我们必须将它们存储在assets文件夹中.然而,我们仍然希望利用Android的自动拾取图像(通过限定符,例如drawable-hdpi,drawable-mdpi等),具体取决于设备的分辨率/密度等.
我的问题是,您知道是否可以在assets文件夹中使用限定符并使用Android机制来选择最佳图像资源?如果没有,您是否知道我可以使用其他方法作为解决方法?
谢谢.
我有一个包含多个模块的项目。一些模块依赖于同一个jar。现在,每个模块都有自己的“ libs”文件夹,其中包含2个相同库的jar。更新jar文件可能会有问题,因为我现在必须更改所有模块中的所有jar。另外,我遇到一个编译问题,说有重复的类。一种解决方法是从除一个模块之外的所有模块中删除jar文件。这是唯一的方法还是有更好的方法?