javascript

java

python

c#

android

c++

node.js

php

html

jquery

ios

reactjs

css

.net

git

ruby-on-rails

sql

c

ruby

string

xml-android include标签-无效的布局参考

我在通过Android布局xml文件中的include标记包含其他布局时遇到问题。 指定布局参考(@layout / ...)时,我在Eclipse ADT中收到一个InflateException并出现以下错误:InflateException:您必须指定一个有效的布局引用。 布局ID @ layout / func_edit_simple_calculator_toolbox无效。

该引用应该是有效的,因为我已经从其他布局的列表中选择了它,并且没有键入它。我正在使用android sdk v2.1

这些是布局文件

func_edit_simple_calculator_toolbox.xml

<?xml version="1.0" encoding="utf-8"?>
<TableLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_height="wrap_content" android:layout_width="wrap_content">

<TableRow android:id="@+id/TableRow01" android:layout_width="wrap_content"android:layout_height="wrap_content">
<Button android:id="@+id/Button01" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="1"></Button>
<Button android:id="@+id/Button02" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="2"></Button>
<Button android:id="@+id/Button03" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="3"></Button>
<Button android:id="@+id/Button04" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="+"></Button>
</TableRow>
<TableRow android:id="@+id/TableRow02" android:layout_width="wrap_content" android:layout_height="wrap_content">
<Button android:id="@+id/Button05" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="4"></Button>
<Button android:id="@+id/Button06" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="5"></Button>
<Button android:id="@+id/Button07" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="6"></Button>
<Button android:id="@+id/Button08" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="-"></Button>
</TableRow>
</TableLayout>

function_editor_layout.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >

<com.calculoid.FunctionView android:id="@+id/function_view" android:layout_width="fill_parent" android:layout_height="fill_parent"/>

<include android:id="@+id/include01" android:layout_width="wrap_content" android:layout_height="wrap_content" layout="@layout/func_edit_simple_calculator_toolbox"></include>
</LinearLayout>

有谁知道可能是什么问题吗?

提前致谢

trans by 2020-08-03T12:21:09Z

如何在Android WebView中获取已加载的网页标题?

我在我的应用程序中使用WebView,我需要根据页面用户所在的位置更改应用程序标题。 如何在Android WebView中执行此操作?

我通过以下行在iphone中完成了此操作

self.title = [webPage stringByEvaluatingJavaScriptFromString:@"document.title"]

@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // Adds Progrss bar Support
        this.getWindow().requestFeature(Window.FEATURE_PROGRESS);
        setContentView(R.layout.webview );

        // Makes Progress bar Visible
        getWindow().setFeatureInt( Window.FEATURE_PROGRESS, Window.PROGRESS_VISIBILITY_ON); 

        mWebView = (WebView) findViewById( R.id.webview ); //This is the id you gave 
        //to the WebView in the main.xml
        mWebView.getSettings().setJavaScriptEnabled(true);   
        mWebView.getSettings().setSupportZoom(true);       //Zoom Control on web (You don't need this 
        //if ROM supports Multi-Touch      
        mWebView.getSettings().setBuiltInZoomControls(true); //Enable Multitouch if supported by ROM

        // Load URL
        Bundle b = getIntent().getExtras();
        String url = b.getString("url");
        Log.d(TAG, "url " + url);
        mWebView.loadUrl(url);


        // Sets the Chrome Client, and defines the onProgressChanged
        // This makes the Progress bar be updated.
        mWebView.setWebChromeClient(new WebChromeClient() {
            public void onProgressChanged(WebView view, int progress){
                //Make the bar disappear after URL is loaded, and changes string to Loading...
                myActivity.setTitle("Loading...");
                myActivity.setProgress(progress * 100); //Make the bar disappear after URL is loaded

                // Return the app name after finish loading
                if(progress == 100)
                    myActivity.setTitle(R.string.app_name);
            }
        });

        mWebView.setWebViewClient(new WebViewClient(){

            @Override
            public boolean shouldOverrideUrlLoading(WebView view, String url) {
                view.loadUrl(url);
                return true;
                // return super.shouldOverrideUrlLoading(view, url);
            }

            @Override
            public void onLoadResource(WebView view, String url) {
                // TODO Auto-generated method stub
                super.onLoadResource(view, url);
            }

            @Override
            public void onPageFinished(WebView view, String url) {
                super.onPageFinished(view, url);
                ImageView logoImageView = (ImageView)findViewById(R.id.logoimage);
                logoImageView.setVisibility(View.GONE);
                Log.d(TAG, "view.getTitle() " + view.getTitle());
                myActivity.setTitle(view.getTitle());
            }

        });

    }
trans by 2020-08-03T12:16:56Z

eclipse-Android Maven找不到工具“ aapt”

我试图按照本教程:

[HTTP://呜呜呜.孤独感Kara.org/2012/11/01/step-不要-step-Android-development-with-maven/]

但是在设置环境并创建项目后,在“运行方式\行家安装”步骤中我得到了:

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building tutorial 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- android-maven-plugin:3.1.1:generate-sources (default-generate-sources) @ tutorial ---
[INFO] ANDROID-904-002: Found aidl files: Count = 0
[INFO] ANDROID-904-002: Found aidl files: Count = 0
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.889s
[INFO] Finished at: Sat May 18 00:32:12 CEST 2013
[INFO] Final Memory: 8M/111M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.1.1:generate-sources (default-generate-sources) on project tutorial: Execution default-generate-sources of goal com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.1.1:generate-sources failed: Could not find tool 'aapt'. Please provide a proper Android SDK directory path as configuration parameter <sdk><path>...</path></sdk> in the plugin <configuration/>. As an alternative, you may add the parameter to commandline: -Dandroid.sdk.path=... or set environment variable ANDROID_HOME. -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException

我已经尝试了很多次,但是没有运气。我在Windows7 64位上安装了Eclipse Juno,安装了APK工具和Maven 3.0.5。

对于Maven员工来说,这似乎是一个众所周知的问题:

[HTTPS://code.Google.com/怕/maven-Android-plugin/issues/detail?ID=104]

但应该千古难解...

我的环境用户变量:

M2_HOME=C:\Program Files\Java\apache-maven-3.0.5

ANDROID_HOME=C:\adt-bundle-windows-x86_64-20130514\sdk

我的环境系统变量:

Path=......;%ANDROID_HOME%\tools;%ANDROID_HOME%\platform-tools;%ANDROID_HOME%\build-tools;%ANDROID_HOME%\platforms;%M2_HOME%\bin;%ANDROID_HOME%\build-tools\android-4.2.2

有人知道如何锻炼这个陷阱吗?

谢谢!

trans by 2020-08-03T12:11:45Z

android-如何在E中测试BOOT_COMPLETED广播接收器

我想用emulator中的操作BOOT_COMPLETED检查BROADCAST RECEIVER

有什么方法可以在模拟器中检查广播接收器吗? 如何重新启动模拟器以检查该接收器? 有什么直接命令吗?

提前致谢。

trans by 2020-08-03T12:06:33Z

android-资产文件夹及其子文件夹中的文件列表

我的Android项目的“资产”文件夹中有一些包含HTML文件的文件夹。 我需要在列表中显示资产子文件夹中的这些HTML文件。 我已经写了一些有关制作此列表的代码。

lv1 = (ListView) findViewById(R.id.listView);
// Insert array in ListView

// In the next row I need to insert an array of strings of file names
// so please, tell me, how to get this array

lv1.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, filel));
lv1.setTextFilterEnabled(true);
// onclick items in ListView:
lv1.setOnItemClickListener(new OnItemClickListener() {
    public void onItemClick(AdapterView<?> a, View v, int position, long id) {
        //Clicked item position
        String itemname = new Integer(position).toString();  
        Intent intent = new Intent();
        intent.setClass(DrugList.this, Web.class);
        Bundle b = new Bundle();
        //I don't know what it's doing here
        b.putString("defStrID", itemname); 
        intent.putExtras(b);
        //start Intent
        startActivity(intent);
    }
});
trans by 2020-08-03T11:15:08Z

android-捏缩放自定义vi

我已经创建了自定义视图,并且想要对我的自定义视图应用捏缩放。 怎么做?

trans by 2020-08-03T10:36:51Z

android-如何使用相机测量物体的高度,宽度和距离?

我提到了很多链接,但仍然无法从任何方面开始开发。 我想用相机测量图像的高度,宽度和距离。 我找到了这个程序。 我想使这种类型的应用程序不完全相同,而是完全相同,但是根据我的要求,我想使用相机测量图像的高度,宽度和距离。

任何人都可以给我/建议我正确的方法或任何示例,以便使我对这一要求有更多的了解。

我尝试了这个:

[HTTP://Android-而.blogspot.in/2012/04/哥特式-distances-from-camera-to-focus.HTML]

trans by 2020-08-03T09:31:18Z

如何从Realm Database Android删除对象?

我想从域中删除所有等于userid的消息对象

RealmQuery<Message> rowQuery = realm.where(Message.class).equalTo(Message.USER_ID, userId);
realm.beginTransaction();
//TODO : here I want to remove all messages where userId is equal to "9789273498708475"
realm.commitTransaction();
trans by 2020-08-03T07:20:27Z

私有内容提供者的用途是什么?

Android开发人员指南说

内容提供商也可用于 读写数据是 对您的应用程序不公开 共享。

通常,内容提供者用于向不同的应用程序提供数据或在它们之间共享数据。 我想知道私人提供者是否有任何用途,不想共享它。 如果不提供对数据库或文件系统的直接访问,是否有任何好处?

谢谢,拉贾特

trans by 2020-08-03T06:13:52Z

android-将抽屉图标更改回b

我正在使用新的Fragment进行侧面导航。 我正在像这样使用抽屉图标(“汉堡”):

@Override
protected void onStart() {
    super.onStart();

    mDrawerLayout = (DrawerLayout) findViewById(R.id.activity_main_drawerlayout);
    mDrawerToggle = new ActionBarDrawerToggle(
            this, 
            mDrawerLayout, 
            R.drawable.ic_navigation_drawer, 
            R.string.app_name, 
            R.string.app_name);
    mDrawerLayout.setDrawerListener(mDrawerToggle);

    getActionBar().setDisplayHomeAsUpEnabled(true);
    getActionBar().setHomeButtonEnabled(true);
}

但是,当我向后堆栈中添加Fragment时,我想再次显示后退箭头,以便用户可以导航回“ home”,然后才打开应用程序抽屉。

如何将抽屉图标重置为后退图标?
我想要的箭头:

Navigation Drawer

trans by 2020-08-03T06:01:19Z

什么是Android Studio生成的<module> /release/output.json

我最近注意到,每次我运行Build-> Generate Signed APK...时,Android Studio 3 Canary 1都会在.gitignore处生成一个新文件,该文件的内容如下所示。

谁能确认也看到这种行为? 还是由于笔记本电脑上的某些本地配置?

谁能解释这个文件的目的? 添加到.gitignore是否安全?

[{
  "outputType": {
    "type": "APK"
  },
  "apkInfo": {
    "type": "MAIN",
    "splits": [],
    "versionCode": 32
  },
  "outputFile": {
    "path": "/path/to/the/generated/release/filename.apk"
  },
  "properties": {
    "packageId": "com.example.android",
    "split": ""
  }
}]
trans by 2020-08-03T04:27:13Z

android-检查密钥在共享首选项中是否存在

我正在创建共享首选项,如下所示

preferences = getSharedPreferences("text", 0);
final Editor editor = preferences.edit();

String s1 = serverIP.getText().toString();
String s2 = serverPort.getText().toString();
String s3 = syncPass.getText().toString();
String s4 = proxyServer.getText().toString();
String s5 = proxyPort.getText().toString();

editor.putString("SERVERIP", s1);
editor.putString("SERVERPORT", s2);
editor.putString("SYNCPASS", s3);
editor.putString("PROXYSERVER", s3);
editor.putString("PROXYPORT", s3);

和onCreate我想在一组新的TextViews中显示这些值,但是第一次我没有在共享首选项中存储任何值,并且将获得NULL指针异常。

我想知道是否有任何内置方法可以检查SharedPreferences是否包含任何值,以便可以检查键是否存在,如果不存在,则将新的TextViews集替换为preferences值。

trans by 2020-08-03T04:14:33Z

图像-使用Picasso库Android无法找到with()的符号方法

我在android应用中遇到一个问题,我正在尝试检查现有的应用,该应用包含

 implementation('com.squareup.picasso:picasso:3.0.0-SNAPSHOT') {
        exclude group: 'com.android.support'
    }

毕加索图书馆和

在类中使用该库,这是代码

import com.squareup.picasso.Picasso;

    Picasso.with().load(url).placeholder(R.drawable.default_pic).into(imageView);

这是错误Error:(49, 20) error: cannot find symbol method with()

我的Android Studio版本是3.0 RC1,这是一个问题吗?

trans by 2020-08-03T03:32:08Z

java-Android上的Integer.parseInt和NumberFormatException

我在Android应用中运行了以下代码

Integer.parseInt("+91");

在Android 5.0(Lollipop)中,它没有引发任何异常,因为+91是整数。 但是在Android 4.4.x(KitKat)和更低版本中,它抛出:

NumberFormatException:无效的Int:“ +91”

Android版本如何造成这种差异?

trans by 2020-08-03T02:23:22Z

无法应用插件Android Gradle插件3.0.0-alpha5不能应用于proj

使用最新的Android Studio 3.0 Canary 5

这是错误:

错误:(1,1)评估项目':app'时发生问题。

无法应用插件[类'com.android.build.gradle.api.AndroidBasePlugin'] Android Gradle插件3.0.0-alpha5不得应用于项目[path_to_my_project],因为版本3.0.0-alpha5已应用于该项目

尝试过:清洁,重建,打开/关闭。 不工作

有任何想法吗 ?

[最新编辑]解决方案:迁移到Canary 8+,一切正常。

trans by 2020-08-03T01:10:32Z

导航抽屉动作栏按钮不起作用

我正在开发一个android项目,并且正在尝试使用[http://developer.android.com/training/implementing-navigation/nav-drawer.html。]中的示例集成新的导航抽屉。

除了一件事外,它通常都可以正常工作,但动作栏上的按钮不显示菜单,但是如果我从边缘在主活动屏幕上滑动手指,那么菜单就会出现,因此我知道实际菜单没有任何问题 ,它只是操作栏按钮。

下面是代码

public class MainActivity extends Activity {

    private DrawerLayout mDrawerLayout;
    private ListView mDrawerList;
    private ActionBarDrawerToggle mDrawerToggle;

    private CharSequence mTitle;
    private CharSequence mDrawerTitle;
    private String[] mPlanetTitles;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        mTitle = mDrawerTitle = getTitle();
        mPlanetTitles = getResources().getStringArray(R.array.planets_array);

        mDrawerLayout = (DrawerLayout)findViewById(R.id.drawer_layout);
        mDrawerList = (ListView)findViewById(R.id.left_drawer);


        MenuItemAdapter menuAdapter = new MenuItemAdapter(this);

        menuAdapter.add(new MenuItem("Hello"));
        menuAdapter.add(new MenuItem("World"));
        menuAdapter.add(new MenuItem("Parsnips"));
        menuAdapter.add(new MenuItem("Turnips"));

        mDrawerList.setAdapter(menuAdapter);

        mDrawerList.setOnItemClickListener(new DrawerItemClickListener());

        getActionBar().setDisplayHomeAsUpEnabled(true);
        getActionBar().setHomeButtonEnabled(true);

        mDrawerToggle = new ActionBarDrawerToggle(
                this,
                mDrawerLayout,
                R.drawable.ic_drawer, 
                R.string.drawer_open,
                R.string.drawer_closed)
        {
            public void onDrawerClosed(View view)
            {
                getActionBar().setTitle(mTitle);
                invalidateOptionsMenu();
            }

            public void onDrawerOpened(View drawerView)
            {
                getActionBar().setTitle(mDrawerTitle);
                invalidateOptionsMenu();
            }
        };

        mDrawerLayout.setDrawerListener(mDrawerToggle);
        if (savedInstanceState ==  null)
        {
            selectItem(0);
        }
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.main, menu);
        return true;
    }

    private class DrawerItemClickListener implements ListView.OnItemClickListener {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            selectItem(position);
        }
    }

    private void selectItem(int position) {
        // update the main content by replacing fragments

        android.app.Fragment fragment = new PlanetFragment();
        Bundle args = new Bundle();
        args.putInt(PlanetFragment.ARGS_PLANET_NUMBER, position);
        fragment.setArguments(args);

        android.app.FragmentManager fragmentManager = getFragmentManager();
        fragmentManager.beginTransaction().replace(R.id.content_frame, fragment).commit();

        mDrawerList.setItemChecked(position, true);
        setTitle(mPlanetTitles[position]);
        mDrawerLayout.closeDrawer(mDrawerList);
    }

    @Override
    public void setTitle(CharSequence title)
    {
        mTitle = title;
        getActionBar().setTitle(mTitle);
    }

    @Override
    protected void onPostCreate(Bundle savedInstanceState)
    {
        super.onPostCreate(savedInstanceState);
        mDrawerToggle.syncState();
    }

    @Override
    public void onConfigurationChanged(Configuration newConfig)
    {
        super.onConfigurationChanged(newConfig);
        mDrawerToggle.onConfigurationChanged(newConfig);
    }

    public static class PlanetFragment extends android.app.Fragment
    {
        public static final String ARGS_PLANET_NUMBER = "planet_number";

        public PlanetFragment()
        {

        }

        @Override
        public View onCreateView(LayoutInflater inflator, ViewGroup container, Bundle savedInstanceState)
        {
            View rootView = inflator.inflate(R.layout.fragment_planet, container, false);
            int i = getArguments().getInt(ARGS_PLANET_NUMBER);
            String planet = getResources().getStringArray(R.array.planets_array)[i];

            //((TextView)rootView.findViewById(R.id.fragment_text_view)).setText(planet);
            getActivity().setTitle("Planet: " + planet);
            return rootView;
        }
    }

    private class MenuItem
    {
        public String menuName;

        public MenuItem(String menuName)
        {
            this.menuName = menuName;
        }
    }

    public class MenuItemAdapter extends ArrayAdapter<MenuItem>
    {
        public MenuItemAdapter (Context context)
        {
            super(context,0);
        }

        public View getView (int position, View convertView, ViewGroup parent)
        {
            convertView = null;
            if (convertView == null)
            {
                convertView = LayoutInflater.from(getContext()).inflate(R.layout.row_menu_item, null);
            }

            /*TextView title = (TextView)convertView.findViewById(R.id.row_title);
            title.setText(getItem(position).menuName);
            title.setVisibility(View.VISIBLE);*/

            EditText title = (EditText)convertView.findViewById(R.id.row_edittext);
            title.setHint(getItem(position).menuName);
            title.setVisibility(View.VISIBLE);

            return convertView;
        }
    }
}

感谢您的任何帮助,您可以提供。

trans by 2020-08-03T00:20:31Z

android-invokedynamic需要--min-sdk-version> = 26

今天下载了Studio 3.0 beta 2.0版本,此后试图在其中打开一个现有项目并遇到了一些困难,其中大多数我可以借助Google和Stack Overflow解决,但我不能解决。

Error:Execution failed for task ':app:transformClassesWithDexBuilderForDebug'.
> com.android.build.api.transform.TransformException: org.gradle.tooling.BuildException: com.android.dx.cf.code.SimException: invalid opcode ba (invokedynamic requires --min-sdk-version >= 26)

同时发布我的应用程序gradle

apply plugin: 'com.android.application'
   android {
    compileSdkVersion 26
    buildToolsVersion "26.0.1"

defaultConfig {
    applicationId "com.intersoft.snappy"
    minSdkVersion 19
    targetSdkVersion 22
    multiDexEnabled true
    versionCode 1
    versionName "1.0"
}
buildTypeMatching 'dev', 'debug'
buildTypeMatching 'qa', 'debug'
buildTypeMatching 'rc', 'release'
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
sourceSets { main { assets.srcDirs = ['src/main/assets', 'src/main/assets/'] 
} }
packagingOptions {
    exclude 'META-INF/DEPENDENCIES.txt'
    exclude 'META-INF/LICENSE.txt'
    exclude 'META-INF/NOTICE.txt'
    exclude 'META-INF/NOTICE'
    exclude 'META-INF/LICENSE'
    exclude 'META-INF/DEPENDENCIES'
    exclude 'META-INF/notice.txt'
    exclude 'META-INF/license.txt'
    exclude 'META-INF/dependencies.txt'
    exclude 'META-INF/LGPL2.1'
}
}
repositories {
mavenCentral()
mavenLocal()
jcenter()
maven { url "https://plugins.gradle.org/m2/" }
maven { url "https://s3.amazonaws.com/repo.commonsware.com" }
maven { url "https://jitpack.io" }
maven { url 'https://dl.bintray.com/ashokslsk/CheckableView' }
maven { url "https://maven.google.com" }

}
android {
useLibrary 'org.apache.http.legacy'
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:26.0.1'
implementation 'com.github.mrengineer13:snackbar:1.2.0'
implementation 'com.android.support:recyclerview-v7:26.0.1'
implementation 'com.android.support:cardview-v7:26.0.1'
implementation 'com.android.support:design:26.0.1'
implementation 'com.android.support:percent:26.0.1'
implementation 'dev.dworks.libs:volleyplus:+'
implementation 'com.google.guava:guava:21.0'
implementation 'com.facebook.fresco:fresco:1.0.1'
implementation 'com.github.bumptech.glide:glide:3.7.0'
implementation 'com.wdullaer:materialdatetimepicker:3.1.1'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.github.stfalcon:frescoimageviewer:0.4.0'
implementation 'com.github.piotrek1543:CustomSpinner:0.1'
implementation 'com.android.support:multidex:1.0.2'
implementation 'com.github.satyan:sugar:1.4'
implementation 'com.hedgehog.ratingbar:app:1.1.2'
implementation project(':sandriosCamera')
implementation('org.apache.httpcomponents:httpmime:4.2.6') {
    exclude module: 'httpclient'
}
implementation 'com.googlecode.json-simple:json-simple:1.1'
}

afterEvaluate {
tasks.matching {
    it.name.startsWith('dex')
}.each { dx ->
    if (dx.additionalParameters == null) {
        dx.additionalParameters = ['--multi-dex']
    } else {
        dx.additionalParameters += '--multi-dex'
    }
}
}
subprojects {
project.plugins.whenPluginAdded { plugin ->
    if ("com.android.build.gradle.AppPlugin".equals(plugin.class.name)) {
        project.android.dexOptions.preDexLibraries = false
    } else if 
("com.android.build.gradle.LibraryPlugin".equals(plugin.class.name)) {
        project.android.dexOptions.preDexLibraries = false
    }
}
}

buildscript {
repositories {
    mavenCentral()
}

dependencies {
    classpath 'com.jakewharton.hugo:hugo-plugin:1.2.1'
}
}

apply plugin: 'com.jakewharton.hugo'

还有我的另一个模块gradle

apply plugin: 'com.android.library'
apply plugin: 'com.jfrog.bintray'
apply plugin: 'com.github.dcendents.android-maven'

buildscript {
repositories {
    jcenter()
    jcenter()
    maven { url "https://maven.google.com" }
}
dependencies {
    classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7'
    classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1'
}
}

group = 'com.sandrios.android'
version = '1.0.8'

ext {
PUBLISH_GROUP_ID = 'com.sandrios.android'
PUBLISH_ARTIFACT_ID = 'sandriosCamera'
PUBLISH_VERSION = '1.0.8'
PUBLISH_CODE = 9
}

android {
compileSdkVersion 26
buildToolsVersion "26.0.1"

defaultConfig {
    minSdkVersion 19
    targetSdkVersion 25
    versionCode PUBLISH_CODE
    versionName PUBLISH_VERSION
}

buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
lintOptions {
    abortOnError false
}
}

task generateSourcesJar(type: Jar) {
from android.sourceSets.main.java.srcDirs
classifier 'sources'
}

task generateJavadocs(type: Javadoc) {
failOnError false
source = android.sourceSets.main.java.srcDirs
classpath += project.files(android.getBootClasspath()
        .join(File.pathSeparator))
}

task generateJavadocsJar(type: Jar) {
from generateJavadocs.destinationDir
classifier 'javadoc'
}

generateJavadocsJar.dependsOn generateJavadocs

artifacts {
archives generateSourcesJar
archives generateJavadocsJar
}

install {
repositories.mavenInstaller {
    pom.project {
        name PUBLISH_GROUP_ID
        description 'Simple integration of universal camera in android for easy image and video capture.'
        url 'https://github.com/sandrios/sandriosCamera'
        inceptionYear '2016'

        packaging 'aar'
        version PUBLISH_VERSION

        scm {
            connection 'https://github.com/sandrios/sandriosCamera.git'
            url 'https://github.com/sandrios/sandriosCamera'

        }
        developers {
            developer {
                name 'arpitgandhi9'
            }
        }
    }
}
}

bintray {
Properties properties = new Properties()

properties.load(project.rootProject.file('local.properties').newDataInputStream())
user = properties.getProperty('bintray.user')
key = properties.getProperty('bintray.apikey')
configurations = ['archives']
pkg {
    repo = 'android'
    name = 'sandriosCamera'
    userOrg = 'sandriosstudios'
    desc = 'Android solution to simplify work with different camera apis.'
    licenses = ['MIT']
    labels = ['android', 'camera', 'photo', 'video']
    websiteUrl = 'https://github.com/sandrios/sandriosCamera'
    issueTrackerUrl = 'https://github.com/sandrios/sandriosCamera/issues'
    vcsUrl = 'https://github.com/sandrios/sandriosCamera.git'
    version {
        name = PUBLISH_VERSION
        vcsTag = PUBLISH_VERSION
        desc = 'Minor fixes.'
        released = new Date()
    }
}
}

repositories {
jcenter()
}

dependencies {
implementation 'com.android.support:support-v4:26.0.0'
implementation 'com.android.support:appcompat-v7:26.0.0'
implementation 'com.android.support:recyclerview-v7:26.0.0'
implementation 'com.github.bumptech.glide:glide:3.6.1'
implementation 'com.yalantis:ucrop:2.2.0'
implementation 'gun0912.ted:tedpermission:1.0.2'
}

以及项目级别的gradle

// Top-level build file where you can add configuration options common to 
all sub-projects/modules.

buildscript {
repositories {
    jcenter()
}
dependencies {
    classpath 'com.android.tools.build:gradle:3.0.0-beta2'

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}
}

allprojects {
repositories {
    jcenter()
    maven {
        url "https://maven.google.com"
    }
}
}

请帮助我摆脱这个错误

trans by 2020-08-02T23:55:55Z

java-如何读取http输入流

下面粘贴的代码来自HttpURLConnection上的Java文档。

我收到以下错误:

readStream(in) 

因为没有这种方法。

我看到同样的事情URLConnection的类概述位于readStream

readStream在哪里? 下面提供了代码段:

 URL url = new URL("http://www.android.com/");   
    HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();   
    try 
    {     
        InputStream in = new BufferedInputStream(urlConnection.getInputStream());     
        readStream(in);  <-----NO SUCH METHOD
    }
    finally 
    {     
        urlConnection.disconnect();   
    } 
trans by 2020-08-02T22:52:48Z

java-发布了错误的通知-无法针对以下项展开RemoteViews:StatusBarNotification

我试图从IntentService的通知区域中发布具有自定义视图的通知,并出现IntentService错误。

这是我在IntentService中所做的事情:

mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
icon = R.drawable.icon;
tickerText = "data upload in progress";
contentView = new RemoteViews(getApplicationContext().getPackageName(), R.layout.notiflayout);
contentView.setImageViewResource(R.id.image, R.drawable.icon);
contentView.setTextViewText(R.id.text, "Hello");
contentView.setProgressBar(R.id.progressBar, 100, 10, false);
whatNext = PendingIntent.getActivity(getApplicationContext(), 0, new Intent(getApplicationContext(), starterActivity.class), 0);
notification = new Notification(icon, tickerText, System.currentTimeMillis());
notification.contentView = contentView;
notification.contentIntent = whatNext;

我正在从IntentService致电IntentService,并在onDestroy()中取消通知。

我已验证该代码可在没有IntentService的独立应用程序中正常工作。在IntentService中这样做会给您带来麻烦。

有人可以解释我做错了什么吗?

谢谢!

trans by 2020-08-02T21:11:14Z

Android:设置CheckBox的颜色

我搜索了很多地方,但似乎无法弄清CheckBox可绘制复选框的边框。 谁能指出我正确的方向?

这是未经检查的样子(几乎看不到方框)

enter image description here

这是检查状态

enter image description here

这就是我想要使它看起来像的东西。

enter image description here

trans by 2020-08-02T20:38:42Z

上一页 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 下一页 共280页