使用Android Studio直接运行应用到模拟器或手机可以运行,直接安装APK文件就报错,找不到主应用程序
工程依赖第三方的优酷类库,直接运行没有编译错误,但是当产生签名的APK时就开始报错优酷代码的错误:在这个文件:
/*
* Copyright (c) 2015 [1076559197@qq.com | tchen0707@gmail.com]
*
* Licensed under the Apache License, Version 2.0 (the "License”);
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.youku.player.ui.widget;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.drawable.AnimationDrawable;
import android.util.AttributeSet;
import android.view.View;
import android.widget.ImageView;
import com.baseproject.utils.Util;
import com.youku.player.ui.R;
public class PlayerLoading extends ImageView {
private static final int LOADING_L = -1;
// private static final int LOADING_M = 0;
private static final int LOADING_H = 1;
private static final String NAME_SPACE = "http://schemas.android.com/apk/res/android";
private static final String TAG = "tag";
private int mLoadingMode;
private float density = 1.5f;
private int mLoadingSize = Util.dip2px(48);
private Context context;
public PlayerLoading(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
this.density = context.getResources().getDisplayMetrics().density;
}
public PlayerLoading(Context context, AttributeSet attrs) {
super(context, attrs);
int bg = R.anim.yp_mobile_loading;
TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.PlayerNewLoading);
String loadingSize = ta.getString(R.styleable.PlayerNewLoading_playerloadingSize);
if(loadingSize == null){
setBackgroundResource(bg);
ta.recycle();
return;
}
if(loadingSize.equals("large")){
mLoadingSize = Util.dip2px(76);
}else if(loadingSize.equals("small")){
mLoadingSize = Util.dip2px(16);
}
ta.recycle();
setBackgroundResource(bg);
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
setMeasuredDimension(mLoadingSize, mLoadingSize);
}
public void startAnimation() {
this.post(new Runnable() {
@Override
public void run() {
AnimationDrawable animationDrawable = (AnimationDrawable) PlayerLoading.this
.getBackground();
animationDrawable.start();
}
});
}
public void stopAnimation() {
this.post(new Runnable() {
@Override
public void run() {
AnimationDrawable animationDrawable = (AnimationDrawable) PlayerLoading.this
.getBackground();
animationDrawable.stop();
}
});
}
public PlayerLoading(Context context) {
super(context);
}
@Override
protected void onVisibilityChanged(View changedView, int visibility) {
super.onVisibilityChanged(changedView, visibility);
if (visibility == GONE || visibility == INVISIBLE) {
stopAnimation();
} else {
startAnimation();
}
}
}
报的错误时:E:\onlineMusic\remusic-master\library_youku\src\main\java\com\youku\player\ui\widget\PlayerLoading.java
Error:Error: Expected resource of type drawable [ResourceType]