你好,我用网页版的老师报错,用的是eclipse
重建了个工程把,代码差不多,报404 错误,用 war上传服务器报找不到指定路径
我们这边一切正常,你在检查下你的访问地址是否正确。
我想问一下,apk中还需要配置么,我现在的问题是点了执行,报找不到指定路径,就是文件写入指定路径那边的错
看了美团关于mete-infl类型的介绍,是不是客户端需要加代码
@mrzoudanwei 要加,就是加获取渠道的代码。我上面都有说明的,你仔细的阅读后再使用
我现在出现的问题是 ,我从请求头获取的filename 是apk的路径,而不是a.txt格式的,导致创建文件时报找不到路径的错误
这个安卓中加入代码是写在哪里的,主activity里面么
你哪里需要就在哪里之前获取都可以。
`/** * 友盟配置 */ private void umengConfig() { String channel = getChannelFromApk(this, "channel-"); if (StringUtils.isEmpty(channel)) { channel = "paojiao"; } if ( Constants.DEBUG ) { Toast.makeText(IApplication.this, "当前渠道:" + channel, Toast.LENGTH_SHORT).show(); } AnalyticsConfig.setChannel(channel); }
/**
* 从apk中获取版本信息
* @param context
* @param channelPrefix 渠道前缀
* @return
*/
public static String getChannelFromApk(Context context, String channelPrefix) {
//从apk包中获取
ApplicationInfo appinfo = context.getApplicationInfo();
String sourceDir = appinfo.sourceDir;
//默认放在meta-inf/里, 所以需要再拼接一下
String key = "META-INF/" + channelPrefix;
String ret = "";
ZipFile zipfile = null;
try {
zipfile = new ZipFile(sourceDir);
Enumeration<?> entries = zipfile.entries();
while (entries.hasMoreElements()) {
ZipEntry entry = ((ZipEntry) entries.nextElement());
String entryName = entry.getName();
if (entryName.startsWith(key)) {
ret = entryName;
break;
}
}
} catch (IOException e) {
e.printStackTrace();
} finally {
if (zipfile != null) {
try {
zipfile.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
String[] split = ret.split(channelPrefix);
String channel = "";
if (split != null && split.length >= 2) {
channel = ret.substring(key.length());
}
return channel;
}`
我从昨天一开始就有个问题困扰我,我点击执行都是提示81行的错误,找不到指定路径,卷标,文件名不正确,我把地址改了也还是这个问题。
这个是war包在服务器运行错误 1111111111111111111form-data; name="file"; filename="Test1.apk
storePath=D:\360Downloads\eclipse-jee-mars-1-win32-x86_64\workspace.metadata.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\AndroidChannelBuild\uploadFileform-data; name="file"; filename="Test1
fileName=form-data; name="file"; filename="Test1.apk baseFileName=form-data; name="file"; filename="Test1 fstr=D:\360Downloads\eclipse-jee-mars-1-win32-x86_64\workspace.metadata.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\AndroidChannelBuild\uploadFileform-data; name="file"; filename="Test1\form-data; name="file"; filename="Test1.apk 二月 15, 2016 10:03:52 上午 org.apache.catalina.core.StandardWrapperValve invoke 严重: Servlet.service() for servlet [fileupload] in context with path [/AndroidChannelBuild] threw exception java.io.IOException: 文件名、目录名或卷标语法不正确。 at java.io.WinNTFileSystem.createFileExclusively(Native Method) at java.io.File.createNewFile(File.java:1012) at cn.finalteam.androidchannelbuild.servlet.FileUploadServlet.service(FileUploadServlet.java:88)
这个是代码运行错误
1111111111111111111C:\Users\H-DIAN\Desktop\Test1.apk
storePath=D:\360Downloads\eclipse-jee-mars-1-win32-x86_64\workspace.metadata.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\AndroidChannelBuild\uploadFileTest1/
fileName=C:\Users\H-DIAN\Desktop\Test1.apk baseFileName=Test1 fstr=D:\360Downloads\eclipse-jee-mars-1-win32-x86_64\workspace.metadata.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\AndroidChannelBuild\uploadFileTest1/\C:\Users\H-DIAN\Desktop\Test1.apk 二月 15, 2016 10:29:09 上午 org.apache.catalina.core.StandardWrapperValve invoke 严重: Servlet.service() for servlet [fileupload] in context with path [/AndroidChannelBuild] threw exception java.io.IOException: 文件名、目录名或卷标语法不正确。 at java.io.WinNTFileSystem.createFileExclusively(Native Method) at java.io.File.createNewFile(File.java:1012) at cn.finalteam.androidchannelbuild.servlet.FileUploadServlet.service(FileUploadServlet.java:88)
代码一样,filename什么的为什么不同呢
改了代码还是出现这个问题
1111111111111111111Test1.apk
storePath=D:\360Downloads\eclipse-jee-mars-1-win32-x86_64\workspace.metadata.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\AndroidChannelBuild\uploadFileTest1
fileName=Test1.apk baseFileName=Test1 fstr=D:\360Downloads\eclipse-jee-mars-1-win32-x86_64\workspace.metadata.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\AndroidChannelBuild\uploadFileTest1\Test1.apk 二月 15, 2016 9:56:46 上午 org.apache.catalina.core.StandardWrapperValve invoke 严重: Servlet.service() for servlet [fileupload] in context with path [/AndroidChannelBuild] threw exception java.io.IOException: 系统找不到指定的路径。 at java.io.WinNTFileSystem.createFileExclusively(Native Method) at java.io.File.createNewFile(File.java:1012) at cn.finalteam.androidchannelbuild.servlet.FileUploadServlet.service(FileUploadServlet.java:88)
请问还在么
解决了,修改了请求头的代码,把=改为\ 还有 360极速模式无法使用 需要ie内核
嗯。解决了就好
不好意思,我还有个问题请教一下,你这个打出来是压缩包的格式,我需要打出来的包是apk而不是压缩包,请问怎么解决
是apk吧,采用META-INF打包方式是不会损坏apk的,不可能是zip等其他格式。你是不是改了哪里
你好,我的意思是我不想下载的包是压缩包格式的,而是apk,这个打好包,下载下来不是zip格式的么,我想下载下来是apk格式的,代码改了不少地方,都不是理想的结果
那你不使用MultiZipDownloadUtil 类就可以了
我也在试网页版的,也是报81行错误,请问怎么改的啊?对这个还不是很熟悉,求指教,谢谢